-
getting movieclips from an external swf to load image on main stage
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??
NO *****ASSNESS AROUND ME!!!!
-
Total Universe Mod
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?
NO *****ASSNESS AROUND ME!!!!
-
Total Universe Mod
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.
-
NO *****ASSNESS AROUND ME!!!!
-
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???
NO *****ASSNESS AROUND ME!!!!
-
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??
Code:
root.addChild(gLoader.iMC.getChildByName("pic1"));
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.
Mainstage(gLoader ( MC ( imgContainerMC (img) ) ) )
NO *****ASSNESS AROUND ME!!!!
-
-
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???
Last edited by maximillion; 10-03-2008 at 01:34 PM.
NO *****ASSNESS AROUND ME!!!!
-
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!!');
}
Last edited by maximillion; 10-03-2008 at 02:43 PM.
NO *****ASSNESS AROUND ME!!!!
-
Please post the code where you load the swf...
-
BUMP anyone else?!?!?! this thing is really frustrating me!!! PLS HELP
NO *****ASSNESS AROUND ME!!!!
-
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);
NO *****ASSNESS AROUND ME!!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|