Link to home
Start Free TrialLog in
Avatar of jsuissa
jsuissaFlag for United States of America

asked on

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

Avatar of Eaddy Barnes
Eaddy Barnes
Flag of United States of America image

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
Avatar of jsuissa

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of Eaddy Barnes
Eaddy Barnes
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial