We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

Save runtime AS3 graphic to FLA Library

jsuissa
jsuissa asked
on
Medium Priority
507 Views
Last Modified: 2013-11-11
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

Comment
Watch Question

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

Author

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
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

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.