A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: problem using loadMovie with jpg and gotoAndPlay

  1. #1
    Junior Member
    Join Date
    May 2006
    Posts
    7

    problem using loadMovie with jpg and gotoAndPlay

    I'm a little new to actionscript, and very new to using loadMovie, so I'm going give a general description about my problem in hopes there is some simple info about it that I'm ignorant to.

    I had a picture gallery (where the pictures were already on the stage) of thumbnails that when clicked on, would slide over to the right side of the screen and increase in size. I then tried to use an XML file containing the picture names to load them into the movie clips. It works fine until they are clicked on (or at any point which gotoAndPlay() is used). The picture disappears immediately. I tried everything I could think of, but it seems that any time i use gotoAndPlay(), it reverts to what is in the container movie clip. Is there something simple I'm overlooking, or any way to fix this so it doesn't disappear? Thanks.

    Paul

  2. #2
    Junior Member
    Join Date
    May 2006
    Posts
    7
    Also, I did search the forums, but nothing I found helped my problem.

  3. #3
    a.k.a gltovar deadlock32's Avatar
    Join Date
    May 2001
    Location
    Naperville,IL
    Posts
    489
    It is kind of unclear to me what exactly is going on, but try putting a movie clip inside of a movie clip and have the pictures load into the 2nd movie clip (_root.movieclip1.movieclip2) and then manipulate the 1st moveclip (_root.movieclip1.gotoAndPlay())

    -untested and unsure what you need exactly-

  4. #4
    Junior Member
    Join Date
    May 2006
    Posts
    7
    I had already tried putting the mc into a 2nd mc.

    Basically what i'm trying to do is load a picture into the mc, then add a tween to the mc so it moves from the left of the screen to the right when clicked on. it works if i'm not having it clicked on, but once i put the stop(); in the 1st frame and the gotoAndPlay() in the on(release), it acts differently. the picture loads fine, but when clicked on, it reverts to whatever was in the mc before the picture loaded (which is blank since it is just a blank mc container).

    Thanks for the reply.

  5. #5
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,876
    upload your files here ... hard to tell wot the problem is like this
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

  6. #6
    Junior Member
    Join Date
    May 2006
    Posts
    7
    I made a simple .fla that shows the problem i'm having. obviously you'll need a picture file named "01.jpg". instead of a blank movie clip for the container, i put a red square in it to show that it goes back to the red square whenever gotoAndPlay() is used.

    Thanks.
    Attached Files Attached Files

  7. #7
    Junior Member
    Join Date
    May 2006
    Posts
    7
    When i don't use stop() to pause the animation and gotoAndPlay() to start it when needed, the .jpg loaded stays in the container. that is why i'm assuming it has something to do with gotoAndPlay();

  8. #8
    im not sure exactly what your fla is supposed to be showing. ><

    what it sounds like to me is something else is getting loaded into the container. The container cannot have any kinda of flash item put into it or it will remove the file you loaded into it.
    FuzzGtp

  9. #9
    Junior Member
    Join Date
    May 2006
    Posts
    7
    I guess I don't know how i could explain it any differently. When you run the movie, 01.jpg is loaded (which i have a picture of a flower) and is shown on the screen. when you click on it, it should just move to the right of the screen and get bigger. but instead, it reverts back to the original mc that it is loaded into (which is a red square). it should be a flower the whole time. i'm not loading anything into it after initially loading the flower jpg into it, which is why i don't understand why it is changing back to the original red square.

  10. #10
    Senior Member
    Join Date
    Feb 2001
    Location
    On the fifth floor.
    Posts
    1,202
    1. Remove all codes from every symbol and eveкy frame of your movie.
    2. Remove all the frames on "mc1"'s timeline (except first one ).
    2. Put this code onto the first frame of the main timeline:
    Code:
     mc1.mc2.loadMovie("01.jpg");
    MovieClip.prototype.goAndGrow = function(x, y, xs, ys) {
    	targetX = x;
    	targetY = y;
    	targetScaleX = xs;
    	targetScaleY = ys;
    	this.onEnterFrame = function() {
    	this._x += (targetX-this._x)*0.4;
    	this._y += (targetY-this._y)*0.4;
    	this._xscale += (targetScaleX-this._xscale)*0.4;
    	this._yscale += (targetScaleY-this._yscale)*0.4;
    	if(Math.abs(this._x-targetX)<=1){
    		delete this.onEnterFrame;
    		}
    	}
    }
    mc1.onRelease = function(){
    	mc1.goAndGrow(450,50,150,150);
    }

  11. #11
    Junior Member
    Join Date
    May 2006
    Posts
    7
    Thanks a bunch!

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