hello!
ok, i have a question. is it possible to make a movie clip thats loaded externally, show a clicked image on the main swf stage??
if it is possible, could someone please show me the source to do it??
hello!
ok, i have a question. is it possible to make a movie clip thats loaded externally, show a clicked image on the main swf stage??
if it is possible, could someone please show me the source to do it??
You could copy the pixels of the clicked image into a new BitmapData object then associate it with a new Bitmap object created on the stage.
PHP Code:import flash.display.BitmapData;
import flash.display.Bitmap;
var myClickedImageData:BitmapData = new BitmapData(img.width, img.height);
myCilckedImageData.draw(img);
//then on the stage.
var bitmapOfClicked:Bitmap = new Bitmap(myClickedImageData);
addChild(bitmapOfClicked);
jAQUAN,
thanks for the speedy reply. the code that you gave me, would that have to be loaded into both the swf containing the images and the main stage, or just the main stage?
I imagine you could record the clicked image data into an object created by the loaded swf and pass a reference to it to a function in the main stage that would complete the process. I've never actually done it so maybe one of the other as3 wizards here could clarify.
bump?? anyone else??
I'm unclear on what you're trying to do...load a swf and then access an image inside it?
exactly. load an swf that has a bunch of images and access them in the main swf... if that's possible???
All you need to do is get a handle on the image...so if you had one in the loadee named pic1 you could add it to the main stage like this:
root.addChild(loadee.getChildByName( "pic1" ));
nez,
could i??
i guess i am worried about depth. because in essence the images i am trying to access are basically "two steps down" inside the gLoader.. e.g.Code:root.addChild(gLoader.iMC.getChildByName("pic1"));
Mainstage(gLoader ( MC ( imgContainerMC (img) ) ) )
That should work fine...
nez,
i tried it your way, i am keep getting an error 1061 at that line.
is there a way to hard code the destination being the main.swf???
addChild(gLoader.getChildByName("iMC").getChildByN ame("pic1"));
Code:galleryMC.award01Btn.addEventListener(MouseEvent.CLICK, showImage);
function showImage(evt:MouseEvent):void{
addChild(Gallery.getChildByName('pic'));
trace('it loaded!!');
}
Please post the code where you load the swf...
BUMP anyone else?!?!?! this thing is really frustrating me!!! PLS HELP
ok, so i dont think i worded this properly. cause after finally getting the darned thing to load it loads in the external swf... i need it to load in the main swf....
Code:galleryMC.award01Btn.addEventListener(MouseEvent.CLICK, showImage);
function showImage(evt:Event){
var request:URLRequest = new URLRequest("award1.swf");
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadProgress);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
function loadProgress(event:ProgressEvent):void {
var percentLoaded:Number = event.bytesLoaded/event.bytesTotal;
percentLoaded = Math.round(percentLoaded * 100);
trace("Loading: "+percentLoaded+"%");
}
function loadComplete(event:Event):void {
trace("Complete");
}
loader.load(request);
root.addChild(loader);