Yes - Flash 8 only. You can't do it with attachMovie unless it's inside
a MovieClip symbol as far as I know.  In Flash 8, you can do this:

import flash.display.BitmapData;

var myGraphic:String = "MyGraphicLinkageID";
var myBitmapData:BitmapData = BitmapData.loadBitmap(myGraphic);
var mc:MovieClip = this.createEmptyMovieClip("myImage",
this.getNextHighestDepth());
mc.attachBitmap(myBitmapData, this.getNextHighestDepth());

Jason Merrill
Bank of America 
Learning Technology Solutions
 
 
 
 
 
 

>>-----Original Message-----
>>From: [EMAIL PROTECTED] [mailto:flashcoders-
>>[EMAIL PROTECTED] On Behalf Of John Conta
>>Sent: Tuesday, June 06, 2006 5:28 PM
>>To: [email protected]
>>Subject: [Flashcoders] Dynamically loading an SWF into a movie clip
>>
>>Hey all,
>>
>>This is my first post.  I'm John.  I've been playing with Flash for a
>>few years now, and after getting a gig, I actually have to follow
>>through with these ideas for once.  Here's my situation, which
consists
>>of two problems:
>>
>>1.  I completed a movie with some pretty intense actionscript which
all
>>sits in one frame  It's pretty long, so I'll post all the code at the
>>end of the email.  Basically, this script organizes and orchestrates
>>the contents of the library - the only thing on the screen is the
>>background image.
>>
>>However, when I try to build a preloader for this movie, I have to
move
>>it back a couple of frames to make some space.  However, whenever I
>>move the blank keyframe containing all of the actionscript, the
>>contents of the library gets SEVERELY downsampled....basically it
looks
>>like it was terribly compressed.  It's for a photography website, so
>>you can imagine how this is totally not OK.
>>
>>This site is http://www.elizabethjochum.com/main.html
>>
>>2.  Since I couldn't make room for a preloader in the main file, I
>>decided to create another movie clip and do it externally.  Here's the
>>code that (was suppposed to) do this:
>>
>>---------------
>>
>>var dasListener:Object = new Object();
>>
>>//uses the listener to power a percentage readout of the loadin
progress
>>dasListener.onLoadProgress = function(target_mc:MovieClip,
>>bytesLoaded:Number, bytesTotal:Number) {
>>    BLART = Math.round(bytesLoaded/bytesTotal*100);
>>    TEXT = BLART+"%";
>>//fades the image to clear as a function of percentage loaded
>>    IMAGETOFADE._alpha = 100 - BLART;
>>};
>>
>>dasListener.onLoadComplete = function(target_mc:MovieClip) {
>>//moves to the last frame in the movie to imbed main.swf
>>      gotoAndPlay(4);
>>};
>>
>>this.createEmptyMovieClip("image_mc", 0);
>>var image_mcl:MovieClipLoader = new MovieClipLoader();
>>image_mcl.addListener(dasListener);
>>image_mcl.loadClip("http://www.elizabethjochum.com/main.swf";,
image_mc);
>>
>>------------------
>>
>>It works very nicely - the percentage goes up, the image fades, and
all
>>is well...until the main.swf comes in.  None of the buttons work, and
>>I'm stuck.
>>
>>I tried playing with the image_mcl.loadClip depths, but the buttons
>>still don't respond!
>>
>>This is what I mean:
>>
>>http://www.elizabethjochum.com/preloader.htm
>>
>>Thanks in advance for any help on this, really...I can't sleep until I
>>figure this one out!!!
>>
>>If I can (1) put the preloader in before the images without losing the
>>quality or (2) embed the swf in the movie clip with full
functionality,
>>I'll be able to go on my merry way.
>>
>>Cheers,
>>
>>John C.
>>
>>_______________________________________________
>>[email protected]
>>To change your subscription options or search the archive:
>>http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>>Brought to you by Fig Leaf Software
>>Premier Authorized Adobe Consulting and Training
>>http://www.figleaf.com
>>http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to