[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 497
  • Last Modified:

Save runtime AS3 graphic to FLA Library

Hello,

I have the following Actionscript 3 code which generates a particle grid. If I wanted to modify the code in Flash, run it and then have what is shown in the FLA (a grid of comma shapes) be saved within the FLA in a movieclip how would I do that?

Thanks.
import flash.display.MovieClip;
import flash.events.*;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
 
 
 
var pixelated_mc:MovieClip = new MovieClip();
addChild(pixelated_mc);
pixelated_mc.y = 0;
pixelated_mc.x = 0;
 
var commaHolder_mc:MovieClip = new MovieClip();
commaHolder_mc.y = 0;
commaHolder_mc.x = 0;
//pixelated_mc.addEventListener(MouseEvent.MOUSE_OVER, onRoll);
 
addChild(commaHolder_mc);
 
var pixelSize = 6;
 
 
 
 
function pixelate(){
    var bitmapData:BitmapData = new BitmapData( original_mc.width/pixelSize, original_mc.height/pixelSize, false );
    var bitmap:Bitmap = new Bitmap(bitmapData);
    pixelated_mc.addChild(bitmap);
    var scaleMatrix:Matrix = new Matrix();
    scaleMatrix.scale(1/pixelSize, 1/pixelSize);
    bitmapData.draw( original_mc, scaleMatrix );
bitmap.width = original_mc.width;
bitmap.height = original_mc.height;
tileBG(pixelSize); 
}
 
 
 
 
function tileBG(pixelNum:Number):void { 
 
for(var i=0; i < original_mc.height/pixelSize; i++) {
  for(var j=0; j < original_mc.width/pixelSize; j++) {
	var commaTile_mc = new commaTile();
    commaTile_mc.x = j * commaTile_mc.width;
    commaTile_mc.y = i * commaTile_mc.height;
	commaTile_mc.addEventListener(MouseEvent.ROLL_OVER, onRoll);
	//trace(commaTile_mc.targetPath)
	commaHolder_mc.addChild(commaTile_mc);
	
	
 
  }
}
 
 
}; 
 
removeChild(original_mc);
 
function onRoll(e:MouseEvent):void  {
	
	e.currentTarget.alpha = 0.5;
	trace(e.currentTarget.name);
 
	trace("CLICK");
	
}
 
pixelate();
//pixelated_mc.mask = commaHolder_mc;

Open in new window

0
jsuissa
Asked:
jsuissa
  • 2
1 Solution
 
Eaddy BarnesITCommented:
i am not sure if i understand your question.
are you basically asking. if you can save the
data generated when you export your swf back to the fla?

GE
0
 
jsuissaAuthor Commented:
Exactly -- that's what we are trying to figure out.

Almost like exporting a bitmap which I know you can do.

Just can you do the same thing with vector data to an FLA or export it to a brand new SWF?

Thanks.

Justin
0
 
Eaddy BarnesITCommented:
Action script cannot effect changes in external items(file formats) without a
third party program or script such as PHP. but even then exporting data
back to the original flalibrary file wont be possible.


GE
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now