dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: loadMovie not waiting for dynamic content

  1. #1
    Member
    Join Date
    Aug 2001
    Posts
    57

    loadMovie not waiting for dynamic content

    I am creating a site where it is loading dynamic images and text within the SWF. Currently for images I am using the loadMovie command. This works typically when I do not have images of significant size, however I am having trouble getting the movie to check up if a larger image needs to be loaded. Here is my current code below, it does not seem to be checking to see if the clip is loaded and simply ignores it if the timeline reaches the actionscript before the image is loaded.
    _root.generalVars.homeImg is a variable that I define outside of flash


    //creating empty placeholder
    this.createEmptyMovieClip("tester",1)
    tester.onData=function(){
    trace("hey")
    }
    //check if loaded
    tester.onLoad=function(){
    trace("loaded")
    }

    tester.loadMovie(_root.generalVars.homeImg)
    tester._x=38.4
    tester._y=88
    SchmidyUC

  2. #2
    Senior Member vinayak.kadam's Avatar
    Join Date
    Oct 2006
    Location
    gotoAndPlay("Pune");
    Posts
    831
    Well, structure of your file or the problem you are facing is not very clearly understood. Can you by any chance upload your FLA and try to explain....

    From your above explanation it seems your probs is that the timeline moves ahead even before the image is loaded and you dont want this to happen....

    Try this:
    - Put a stop() action on the frame where the above code is written
    - in the onLoad() function put a play() action which will run once the image is loaded!
    As ever,
    Vinayak Kadam

  3. #3
    Member
    Join Date
    Aug 2001
    Posts
    57
    got it, earlier in the process i did have the stop command and i also had the play command onLoad. THe play command wasnt firing however no matter how i arranged it. I finally happened upon the onLoadInit command which saved the day. the working code (AS2) looked like this:

    var url:String = "myImage.jpg";

    var movieClip:MovieClip = createEmptyMovieClip("movieClip", 0);

    var listenerObj:Object = new Object();
    listenerObj.onLoadInit = function (target_mc:MovieClip):Void {
    target_mc._x = 385 + ((Stage.width - target_mc._width) / 2);
    target_mc._y = -370;
    _parent.play()
    }

    var movieClipLoader:MovieClipLoader = new MovieClipLoader();
    movieClipLoader.addListener(listenerObj);
    movieClipLoader.loadClip(url, movieClip);
    SchmidyUC

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center