Load movieclip

Hey, hopefully someone can help me out. I'm having a problem
getting the load movieclip script to work. Here's my situation, I
have a swf file that I want to load into another swf, I have this
test file that I'm working on, I created the swf that I want to
pull in. no problem. I attach the load movie script to a button I
pull from the UI Components and when I test the movie it works,
plays the swf file just right. I create, say a oval for example,
make that a button and attach the script and test the movie,
nothing! Not sure what I'm doing wrong. I can attach .fla file if
need be. Thanks for any help.
Dt

Hey no problem. Nothing to apologize for and remember, "There
are no stupid questions, just stupid people asking question." :)
(That is totally meant as a joke!) We all have to start someplace.
First, I don't think there is a click event for movieclips.
There is for the UI components, but for movie clips or button
instances you would use Press or Release. I haven't used that kind
of coding since 2001, so I'm not quite familiar with the exact
capitalization. See, this is something that without seeing the code
we would go around for hours on!
But there is a more important issue – IMHO – and
this is you are using the old (From Flash 5 days) style of coding
event handlers. The approach given by _name above is much more
modern, easier to use and maintain, and just plain better. David
Stiller who helps out here a lot has a great entry in his blog
about it. Check this link out:
http://www.quip.net/blog/2006/flash/museum-pieces-on-and-onclipevent

Similar Messages

  • Flash CC: Load MovieClip using button

    Im here because im really stuck, and i need to finish my job quiclky.
    I never used FLash CC, I always used Flash 8... So much easy to load clips etc.
    Well, Here is the .FLA in Flash CC format so u guys can give me a little hand (please).http://www.sendspace.com/file/u6mh4p
    The thing that i want to do is: When i make click on button History (first button on the left side) "Not the logo" i Want to load MovieClip called History (stopped one).
    I really appreciate any help.
    Thanks in advance RushWHQ

    assign your button an instance name (done same way in cc as flash 8 - eg, history_btn) and assign your library movieclip a class (right click the library symbol >click properties>tick export for actionscript>enter a class name in the class field - eg, HistoryClass).  then in the actions panel, use:
    var history_instance:HistoryClass;
    history_btn.addEventListener(MouseEvent.CLICK,f);
    function f(e:MouseEvent):void{
    history_instance=new HistoryClass();
    addChild(history_instance);

  • Adding "loading" movieclip to dynamic image gallery?

    Hello again,
    I've completed my XML-driven image gallery, however upon live testing I'd realized I made a rookie mistake and not put some kind of placeholder "loading" movie clip loop while the thumbnails—and subsequent full-size images—are being loaded. The images will randomly appear when loaded and I would like to be able to insert a placeholder movie clip while they load, and swap them up with the thumbnails/images after it has been loaded. The placeholder movie clip is in my library (loadingLoop), but I'm having problems getting it to work correctly.
    Below is the original function that processes the XML and adds the thumbnail images; this is where I'm trying to insert the placeholder movie clip per XML child node (every attempt I've made just keeps throwing more errors, so I've omitted my attempts to avoid confusion), and I've attached the XML file for testing. And insight or help would be appreciated.
    //Locate the external XML file and trigger xmlLoaded when complete
    xmlLoader.load(new URLRequest("data/artGallery.xml"));
    xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
    //Load the XML and process the image locations
    function xmlLoaded(event:Event):void {
        xml = XML(event.target.data);
        //parse the nodes in the XML file
        xmlList = xml.children();
        //count the number of nodes in the XML file via XMLList
        trace(xmlList.length());
        //loop to load all of the thumbnails, based on the number of nodes in XMLList
        //"i" = every child node in the XML file
        for (var i:int = 0; i < xmlList.length(); i++) {
            //Add loadingLoop movie clip per node and wait for thumnail to load before swapping out with imageLoader thumbnail images <-- help!!
            //for every node, create a new instance to be put on stage
            imageLoader = new Loader();
            //load each thumbnail from its location per XML node's "thumb" attribute
            imageLoader.load(new URLRequest(xmlList[i].attribute("thumb")));
            //position of thumbnail instances per XML node (horizontally across stage)
            imageLoader.x = i * 110 + 10;//thumbs are 100 x 100 so, +10 to the width, plus +10 from left edge
            //imageLoader.y = 10;
            //for each node in XML list, name the instance with the path to the location of the full size image
            imageLoader.name = xmlList[i].attribute("source");
            //for each node in the XML list, add a drop shadow
            imageLoader.filters = [thumbDShadow];
            //add thumbnails to stage
            addChild(imageLoader);
            dropTween = new Tween(imageLoader, "y", Bounce.easeOut, -100, 10, 1, true);
            //set up thumbnails to wait for a click to execute showPicture
            imageLoader.addEventListener(MouseEvent.CLICK, showPicture);
            //set up thumbnails to scale when rolled over
            imageLoader.addEventListener(MouseEvent.ROLL_OVER, sizeUP);

    Somehow I had a feeling this wouldn't be a copy-and-paste job for the full-size images. Sorry to be a bother. This is the showPicture function that is fired off when the thumbnail image is clicked (from our previous example). Two errors are thrown:
    When the thumnail is clicked:
    "Error #2007: Parameter child must be non-null.
        at flash.display::DisplayObjectContainer/removeChild()
        at MethodInfo-51()"
    But the full-size image loads nonetheless. The second loading loop (loadingLoop2) is not removed. Below is the showPicture function:
    //Load the full-size images and place onto the stage
    function showPicture(event:MouseEvent):void {
        //add new movie clip container
        var mc2:MovieClip = new MovieClip();
        addChild(mc2);
        //clear the fullLoader—this is to help clear any full-size images that may already be on the stage (they have two options, click a new thumbnail, or close the current full-size image
        fullLoader.unload();
        //re-create the fullLoader, if there was one cleared
        fullLoader = new Loader();
        //load each full size image from its location per XML node's "source" deliniated by mc.ldr's "source" attribute
        fullLoader.load(new URLRequest(event.target.name));
        //add the loder to the container
        mc2.addChild(fullLoader);
        //create new instance of second loading loop
        mc2.fsloop = new loadingLoop2();
        //add the second loading loop to the container
        mc2.addChild(mc2.fsloop);
        //for each container, add a drop shadow
        mc2.filters = [fullDShadow];
        //set the container's position center on stage, making it the size of the loading loop until the full-size images are loaded
        mc2.x = (stage.stageWidth - mc2.fsloop.width) * 0.5;
        mc2.y = (stage.stageHeight - mc2.fsloop.height) * 0.5;
        //place container on stage
        addChild(mc2);
        //fade in each container
        fadeTween = new Tween(mc2, "alpha", None.easeNone, 0, 1, 0.5, true);
        //check to see if the image has been loaded completely—this is to make sure the image's attributes can be used to re-center on stage and remove fsloop
        fullLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, removeLoop2);
        //set field to multiline so that the <br> HTML tags can be used
        imageTextField.multiline = true;
        //add text frame for description
        imageTextField.x = 10;
        imageTextField.y = 125;
        //for each full-size image, load the description text from the XML child nodes
        for (var j:int = 0; j < xmlList.length(); j++) {
            //check to make sure that the correct full-size image matches the text node when clicked
            if (xmlList[j].attribute("source") == event.target.name) {
                //add each child node as a separate line in the same text field; added HTML tags for CSS application
                imageTextField.htmlText = "<p><span class = 'projectName'>" + xmlList[j].child("projectName") + "</span><br>"
                + "<span class = 'toolsUsed'>" + xmlList[j].child("toolsUsed") + "</span><br><br>"
                + xmlList[j].child("projText") + "<br>"
                + "<span class = 'liveURL'>" + xmlList[j].child("liveURL") + "</span></p>";
        function removeLoop2(event:Event):void {
            //re-position the container to center on stage to accomodating the full sized image
            mc2.x = (stage.stageWidth - fullLoader.width) * 0.5;
            mc2.y = (stage.stageHeight - fullLoader.height) * 0.5;
            //Add the text field
            addText();
            //hide instructional text, already on stage
            galleryInfo_mc.alpha = 0;
            //remove the full-sized loading loop
            event.target.loader.parent.removeChild(MovieClip(event.target.loader.parent).loadingLoop2 );
        //set up full-size images to "self close" by clicking on it
        mc2.addEventListener(MouseEvent.CLICK, clearStage);
    The second error gets thrown when the container is clicked and the function clearStage is executed, which does not remove the container:
    "TypeError: Error #2007: Parameter child must be non-null.
        at flash.display::DisplayObjectContainer/removeChild()
        at artGallery_v1_5_fla::MainTimeline/clearStage()"
    This is the clearStage function:
    //Allow full-size image to "self close" by clikcing on it and removing the text description
    function clearStage(event:MouseEvent):void {
        //clear the fullLoader
        fullLoader.unload();
        //remove the container
        event.target.parent.removeChild(MovieClip(event.target.parent).mc2);
       //remove the text field
        removeChild(imageTextField);
        //show the instructional text that is on-stage
        galleryInfo_mc.alpha = 1;
    Help!

  • Can you specify movieclips as cache as bitmap, inside one large loaded movieclip?

    at this point I'm not sure if i have to individualy add cacheasbitmap/cacheasbitmapmatrix to true to each display object that needs it and load them seperatly
    or if i can load the movieclip that they are in first and specify their properties later then add it to the stage when it is all loaded.
    can anyone tell me the best way to do this or maybe some tutorials to check out?
    the AS for the loading is
    var PLoading:Bitmap = new Bitmap (new PlaneLoading());
    addChild(PLoading); //loading screen
    var PLevel:PlaneLevel = new PlaneLevel();
    this.addEventListener(Event.ENTER_FRAME, loading); //reoccuring event listener happens as often as is set by FPS
    function loading(e:Event):void //
        var total:Number = this.stage.loaderInfo.bytesTotal;
        var loaded:Number = this.stage.loaderInfo.bytesLoaded;
        var percent:Number = loaded/total * 100;
        trace (percent);
        if (total == loaded) //checks if all bytes for all movieclips have been loaded
            this.removeEventListener(Event.ENTER_FRAME, loading);
            onComplete();
    function onComplete ():void //removes loading picture, and loads level movieclip
        removeChild(PLoading);
        addChild(PLevel);
        PLevel.x = 475.15;
        PLevel.y = 315.35;

    It is the same do it individually for each MovieClip or all contained in a MovieClip. What you should know is that a movie clip with cachebitmap = true consume resources whenever it is drawn and if a movie clip is an animation, each frame will be redrawn. 
    look this:
    http://help.adobe.com/en_US/as3/mobile/WS4bebcd66a74275c36c11f3d612431904db9-7ffc.html

  • Accessing scenes in dynamically loaded MovieClip?

    Dear experts,
    I have used ming 0.4.2 to produce a simple SWF with one
    stroke per frame and grouped handfulls of frames into scenes - all
    of them labeled for easy tracing. If I look at the resulting raw
    file I can see the scene labels near the end as what seems to be a
    simple list of offset/label pairs. If I compile the latest swftools
    (almost 0.9.0 - needs minor Makefile adjustments) I can use swfdump
    to see that there is in fact a SCENEDESCRIPTION tag there (earlier
    versions do not recognize tag 056).
    However, when I load this into my flex program the movieclip
    claims that there is only a single unlabeled scene containing all
    the frames - presumably indicating that is has ignored the scene
    description.
    How can I persuade it to do the right thing?
    Note that in order to be able to control the playback of the
    movieclip (gotoAndStop etc) I have had to use
    This
    Trick.
    For various other reasons, my app requires flash 9 r124 or
    later. I have tried flash 10 with the same results.
    All advice appreciated.

    Update: I just saw there was a new release of swftools and
    the new swfdump knows about the 0x056 tag which dumps nicely as you
    can see at the end of this message.
    So, the file certainly verifies OK. Maybe I've missed
    something very obvious? (Beyond the somewhat vague: "you shouldn't
    use scenes" that seems to be a hint here and there.)

  • Loading movieclip

    Got a bit of a problem.  Say I have on my stage several different buttons, and each one will load a movieclip from the library, how would I go about achieving this?  I have tried making a loader to load all the different movieclips.   When it goes into the function of a button click, I do unloadAndStop, as I think this will remove anything from the loader if something is there already.  I then try doing things like
    myLoader.load(new URLRequest("myMovieClip"));
    myLoader.addChild(myMovieClip);
    etc
    None of the above seem to work.
    Any advise appreciated
    cheers
    Nick

    You want to add symbols from the Library on the Stage? If so, you don't need Loader class - Loader is for an external content (another *.swf on the server).
    You instantiate your symbols from the library directly:
    1) In Library, select the symbol you would like to add to stage via ActionScript, rightclick -> Properties
    2) set Export for actionscript: true
    3) in Class field, type "MySybol"
         - actually, you type whatever name you want - this will be the symbol's identifier fo ActionScript
         - you can use also packages: ui.buttons.NextPageButton
    in code you type:
    var mySymbolInstance = new MySymbol();
    addChild(mySymbolInstance);

  • Get content of dynamically loaded movieclip

    Hey,
    After trying to no avail to get the totalframes of a dynamically loaded .swf in AS3 I've regressed to AS2.
    Now I can add the clip and get the totalframes of the content, no problem.
    THe problem is I cannot resize the content at all.
    I have no idea how to target the loaded content.
    Here's the code I'm using:
    var myXML:XML = new XML();
    var path:String;
    var mcl:MovieClipLoader = new MovieClipLoader();
    var mclm:MovieClipLoader = new MovieClipLoader();
    var mclL:Object = new Object();
    var frames:Number;
    var i:Number = 0;
    var mc:MovieClip = new MovieClip
    myXML.ignoreWhite=true;
    myXML.load("content.xml");
    holder_mc._alpha = 0;
    myXML.onLoad = function(xmlLoaded){
    menu();
    load();
    mclL.onLoadComplete = function() {
              frames = (MovieClip(holder_mc)._totalframes);
              if (frames == 1) {
                   image();
              else if (frames > 1) {
                   clip();
    load = function(){
         clearInterval(timer);
         path = myXML.firstChild.childNodes[i].childNodes[1].childNodes[0].nodeValue;
         mcl.loadClip(path, holder_mc);
         var tFiles:Number = myXML.firstChild.childNodes.length;
         if (i < tFiles){
              i++;
         else if (i == (tFiles)){
              i=0;
              load();
         mcl.addListener(mclL);     
    image = function() {     
         seconds=1000;
         holder_mc._alpha = 100;
         timer = setInterval(load, seconds);
    clip = function() {     
         holder_mc._alpha = 100;
         ftimer = setInterval(checkFrames, 100);
    checkFrames = function() {
              frame = (MovieClip(holder_mc)._currentframe);
              if (frame==(frames-1)){
                   clearInterval(ftimer);
                   load();
    menu = function(){
         var tFiles:Number = myXML.firstChild.childNodes.length;
         for (me=0; me < tFiles; me++){
         path = myXML.firstChild.childNodes[i].childNodes[1].childNodes[0].nodeValue;
         i++;
         _root.attachMovie("circle", "circle"+me, me, {_x:(me*30), _y:330});
         mclm.loadClip(path, ("circle"+me));     
    I need to resize the content both for the main holder_mc as well as for the menu elements.

    Thank you for the response.
    Unfortunately that didn't work.
    Even if I try to trace either target._width or holder_mc._width where you suggested I get 0 values.
    The only values I did manage to get was when I put the trace in the load() function but they were out of sync with the images being loaded.
    I even tried it on a simpler model:
    var myXML:XML = new XML();
    var path:String;
    var mcl:MovieClipLoader = new MovieClipLoader();
    var mclL:Object = new Object();
    var frames:Number;
    var i:Number = 0;
    var tFiles:Number;
    myXML.ignoreWhite=true;
    myXML.load("content.xml");
    myXML.onLoad = function(xmlLoaded){
    path = myXML.firstChild.childNodes[i].childNodes[1].childNodes[0].nodeValue;
    tFiles = myXML.firstChild.childNodes.length;
    loader();
    loader = function() {
         mcl.loadClip(path, holder_mc);
         mcl.addListener(mclL);
    mclL.onLoadComplete = function(target:MovieClip) {
         trace(target._width);
         trace(holder_mc._height);
    ..and I still get 0 values.

  • Loaded movieclip with component

    hi to everyone.These days i have some very interesting and
    unsuspected problem with components exatcly ComboBox component.I
    have one index.swf file into index.swf i load another movieclip
    with two instance of ComboBox and when i try to open the combobox
    and get some element from his i cant open it.I use MovieClipLoader
    to load the second swf file with components inside.Every other
    component like button, checkbox and etc. work perfect.When i click
    to ComboBox , he get focus with green border (when use Tab button
    from keyboard into flash).But when i open only the second file
    1.swf work perfect the problem coming only when i load the file
    info index.swf.Any idea how to fixed?

    You need a comboBox instance in the parent movie.
    Dave -
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • Loading MovieClips.

    I'm quite new to ActionScript and wondered what the best way
    to load a MovieClip was. I wanted to have a button that loaded an
    already created MovieClip when it was clicked on and then also have
    a button inside the MovieClip that would 'close' it when that was
    clicked.

    don't load into _level0 unless you want to replace your main
    swf and everything else with your external swf.
    you can also load into a target movieclip that's in your main
    swf using loadMovie() or using the moviecliploader class with its
    loadClip method. but, for your needs, it would be simpler to use
    loadMovieNum.

  • Load Movieclip where Mouse was clicked

    Hello,
    I got a request to have a "ripple" animation play where the
    mouse was clicked (like the application is in a puddle) and i am
    using AS2 in CS3 and i am not able to get this to work (and really
    surprised i havent ever come across this before). I would like to
    just load an instance of my "ripple_mc" out of the library where
    and when the mouse is clicked.
    i have searched for some tutorials but cant seem to find what
    i am looking for, if anyone can point me to a tutorial or throw
    some code down for me i would really appreciate it
    thanks in advance!

    i put an invisible button in the background and an empty
    movieclip with the instance name "loader_mc" on the stage with the
    following actions on the button:
    on(release){
    loader_mc._x=_xmouse;
    loader_mc._y=_ymouse;
    loader_mc.attachMovie("ripple", "new", 200);
    i would like to eliminate the invisible button and have
    multiple insances of "ripple" able to happen at once...
    the above fla can be downloaded here:
    http://www.michaelsaathoff.com/sample.fla
    thanks!

  • Accessing mouse x & y in a loaded movieclip

    Hi,
    I have a movieclip that gets loaded into another container.  The movieclip reads the mouse x & y position to resize a circle according to the mouse position - it works fine on its own, but when the movieclip is loaded into a container I think the actionscript is reading the container's x & y, not from the mc itself.
    The code I'm using to read the mouse x & y is:
    d = Math.sqrt(Math.abs(_root._xmouse-this._x)*Math.abs(_root._xmouse-this._x)+Math.abs(_root. _ymouse-this._y)*Math.abs(_root._ymouse-this._y));
    It works out the distance of the mouse from the central point (centre of the circle movieclip.)
    Like I say, it works fine on its own, but when in another container the _root is causing the x & y to be displaced.  I've tried _lockroot, but that stops other stuff working properly in the movieclip (drag and drop.)
    Is there another way I can directly access the x & y properties of the main movieclip without using _root?

    I am not sure what the scenario is as far as where that code is relative to where the objects are, but when you place the mc inside a container, its _x and _y values are relative to the container at that point.  So you probably either need to change from using the _root.xmouse to using the container._xmouse (etc), or make use of the localToGlobal() method to translate this._x to _root relative _x.

  • Change position of loaded movieclip

    Hi there.
    I have an xml flash gallery at a .swf file and i want to load this .swf to main.swf.
    So, i use the code:
    var loader:MovieClipLoader = new MovieClipLoader();
    this.createEmptyMovieClip("myGalleryContainer",1);
    myGalleryContainer._lockroot=true;
    loader.loadClip("Myslideshow.swf",myGalleryContainer);
    Its working just fine but i get my flash gallery aligned to the center of main.swf.
    How can i move this created movieclip  to wherever i want with some code?
    I tried this:
    MyGalleryContainer.y = 200;
    MyGalleryContainer.x = 50;
    with no results.
    Any ideas?
    Thank you in advance

    If what you showed is what you used, there are two problems with it. x,y should be _x,_y, and MyGalleryContainer should be myGalleryContainer
    myGalleryContainer._y = 200;
    myGalleryContainer._x = 50;

  • [noob question] whats the best way to load movieclips with a loading screen

    for each level i have a number of movieclips bitmaps and sprites etc.. should i just load multiple swf's of everything in my level or keep all objects in the library and call upon them in the main fla
    this is for a mobile game btw.
    I have a loading screen.png file also, how do i know when each item is finished loading to stop the loading screen image?

    If you have money to spend, I would recommend using Oracle's Application Test Suite (ATS) since it is the only test tool I know of that allows you to create a functional test and then convert it to a load test. The capabilities of this tool are pretty amazing considering that it is a single tool where the go to toolset in the past was Win Runner / Load Runner. With Win Runner, you needed 50 machines (or VMs) if you wanted to generate front end load for 50 users. With ATS, you record a script with your browser, and then convert it into a load test. You can adjust things like think time, ramp up time, sustained load, etc.
    What a lot of people miss is that testing tools can be used indefinitely, not just for getting through a migration. If you script your tests appropriately (which means that your user base trusts them), you can use them for every code release because it takes very little effort to run a test script. On top of that, you can set up strategically placed machines around your network that are set up to run a specific test script (think of a common transaction) so that performance metrics can be captured. I worked for a company that had 160 locations around the world and we used our testing tool as a performance monitor in the locations with the worst performance. Having a tool allowed us to see whether our performance issues were related to network, database, app servers, etc. This took the burden of explaining performance issues off of the users. Most users can't really articulate what the problems are anyway (and they aren't expected to).
    If budget is an issue, you can use JMeter from Apache, which will give you the load testing capability but you will miss out on the excellent reporting and management capabilities of the Oracle Application Test Suite.

  • As2 for load movieclip

    im having a problem..i,e. i need to load an external swf which is in as3...and need it to be played in my as2 swf layout. with a time slider ,play, pause ,next, previous for that swf movie clip. pls give ur mail id i can sent my original files....................pls help me
    download tis jpg image and convert to rar r zip file.....

    duplicate thread.   ignore.

  • As2 for load movieclip swf file

    im having a problem..i,e. i need to load an external swf which is in as3...and need it to be played in my as2 swf layout. with a time slider ,play, pause ,next, previous for that swf movie clip. pls give ur mail id i can sent my original files....................pls help me
    download tis jpg image and convert to rar r zip file.....

    AS2 and AS3 are incompatible. Although you can load AS2 into AS3  - you CANNOT load AS3 swf into AS2.

Maybe you are looking for

  • How to purge the workflow which is in process

    Hi Friends, I am facing one problem in the AME Workflow. when a user submit a page for approval process, workflow engine invokes . and in the hr_api_transcations table transacation id is created for that workflow transacation. now the problem is, if

  • Numbers not appearing in iCloud Settings

    I was just looking through the settings on my iPhone 4S running iOS 7.0.4 and discovered that Nubmers was not displayed as an option in iCloud. Keynote and Pages both display just fine. I went to settings for Numbers and turned iCloud off and reset m

  • Formulae variable confusion/ abap routine

    in ods i have data like Postingday................value1........value2 1/26/10............70.................50 1/27/10............60.................48 12/30/10............120.................55 12/31/10............10.................52 now in the r

  • Determining Size of Requests & Responses

    Hi there, I'm looking for a reliable and consistent means of determining the size of data transferred between clients and Servlet-based server-side applications over HTTP. I've been exploring doing this with a Servlet Filter which would attempt to me

  • Oracle Array Update and sqlerrd[2] in PROC/C++ HELP!!!!!!!!!!!

    Coding an array update in Pro C/C++ in an Oracle 8.0.5 environment (don't ask...). Having trouble when errors occur in one of the updates... If I have an array of 5 updates, (EXEC SQL FOR 5...), with the first update on a non-existant row, I expect O