A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: Actionscript: Stop playing at frame codehelp!!

  1. #1

    Actionscript: Stop playing at frame codehelp!!

    Hi cool people!!

    Ok, i've done some actionscripting! wow for me, and it works fine - it depending on variables it stops the progress of something at a certain frame depending on variables sent to the flash file... however... i want to make it play UPTO the certain frame, as opposed to it just landing on that frame immediately! Does that make sense? I can't figuire out how to write that into this code:

    Code:
    complete4 = totalgirls;
    total = 180000;
    if (complete4 == total) {
    	gotoAndStop(100);
    }
    frame = int(complete4/(total/100));
    tellTarget (_root.Girls) {
    	gotoAndStop(_root.frame);
    }
    So where it says
    gotoAndStop(_root.frame);
    It needs to say something like
    gotoAndPLAYUPUNTIL(_root.frame);

    Haha, i wish that was correct coding hehe

    Please help if you can

  2. #2
    Senile member! :)
    Join Date
    Dec 2001
    Location
    Saunaswamp (transl)
    Posts
    2,296
    Code:
    complete4 = totalgirls;
    total = 180000;
    if (complete4 == total) {
    	gotoAndStop(100);
    }
    frame = int(complete4/(total/100));
    _root.Girls.onEnterFrame = function()
    {
    	if(this._currentframe == _root.frame);
    	{
    		this.stop();
    		delete this.onEnterFrame;
    	}
    }
    _root.Girls.play();
    /Mirandir

  3. #3
    Quote Originally Posted by Mirandir
    Code:
    complete4 = totalgirls;
    total = 180000;
    if (complete4 == total) {
    	gotoAndStop(100);
    }
    frame = int(complete4/(total/100));
    _root.Girls.onEnterFrame = function()
    {
    	if(this._currentframe == _root.frame);
    	{
    		this.stop();
    		delete this.onEnterFrame;
    	}
    }
    _root.Girls.play();
    /Mirandir
    Thanks a lot for that, but Hmm, doesn't seem to work, the progress seems to just be stuck at zero and doesn't go anywhere? These are the variables in the HTML file that tell the movie where it should be if thats of any help?!

    Code:
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="480" height="335">
      <param name="movie" value="Walkmenvwomen.swf" />
      <param name="quality" value="high" />
      <param NAME=FlashVars VALUE="totalgirls=98000&totalboys=28000">
    
      <embed src="Walkmenvwomen.swf" FlashVars="totalgirls=98000&totalboys=28000" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="480" height="335"></embed>
    </object>

  4. #4
    Senile member! :)
    Join Date
    Dec 2001
    Location
    Saunaswamp (transl)
    Posts
    2,296
    It's probably because you need to convert totalgirls from String to Number.

    Code:
    complete4 = Number(totalgirls);
    total = 180000;
    if (complete4 == total) {
    	gotoAndStop(100);
    }
    frame = int(complete4/(total/100));
    _root.Girls.onEnterFrame = function()
    {
    	if(this._currentframe == _root.frame);
    	{
    		this.stop();
    		delete this.onEnterFrame;
    	}
    }
    _root.Girls.play();
    /Mirandir

  5. #5
    Quote Originally Posted by Mirandir
    It's probably because you need to convert totalgirls from String to Number.

    Code:
    complete4 = Number(totalgirls);
    total = 180000;
    if (complete4 == total) {
    	gotoAndStop(100);
    }
    frame = int(complete4/(total/100));
    _root.Girls.onEnterFrame = function()
    {
    	if(this._currentframe == _root.frame);
    	{
    		this.stop();
    		delete this.onEnterFrame;
    	}
    }
    _root.Girls.play();
    /Mirandir
    Hmm still doesn't seem to want to go anywhere... would it help if i ul'd the fla/html file for you? thanks so much for your help!

  6. #6

  7. #7
    can anyone else help i still can't get it working

  8. #8
    anyone??? p - p - p - please?!

  9. #9
    still at a complete loss
    can no one help???

  10. #10
    Junior Member
    Join Date
    Oct 2005
    Posts
    26
    1. In this line:

    if(this._currentframe == _root.frame);

    you need to remove the semicolon at the end. Otherwise, the statement block afterward will execute automatically.

    2. The file bugs if the _complete_ variable is too low.

  11. #11
    Great that worked! but i'm still not quite there... i have another file using exactly the same method of measuring progress... but there are two progress bars - it is a measurement of women in comparison to the men! However, i cannot for the life of me get the men and women to go seperately, it simply applies the position to both of them, depending on the code that it fetches last... the code is written like this:

    Code:
    complete3 = Number(totalboys);
    total = 180000;
    if (complete3 == total) {
    	gotoAndStop(100);
    }
    frame = int(complete3/(total/100));
    _root.Boys.onEnterFrame = function()
    {
    	if(this._currentframe == _root.frame)
    	{
    		this.stop();
    		delete this.onEnterFrame;
    	}
    }
    _root.Boys.play();
    cheese = Number(totalgirls);
    total = 180000;
    if (cheese == total) {
    	gotoAndStop(100);
    }
    frame = int(cheese/(total/100));
    _root.Girls.onEnterFrame = function()
    {
    	if(this._currentframe == _root.frame)
    	{
    		this.stop();
    		delete this.onEnterFrame;
    	}
    }
    _root.Girls.play();
    But it will only use the tags for the girls so they both goto the same position!!?

    Code:
    NAME=FlashVars VALUE="totalgirls=98000&totalboys=18000"

    thanks again for all your help, really appreciate it!

  12. #12
    Junior Member
    Join Date
    Oct 2005
    Posts
    26
    Both the code snippets use the same variable, "frame", to check where they should stop. You need two different variables - say, "frameBoys" and "frameGirls".

  13. #13
    Ahha! I am a dipstick aren't i? hehe, thanks again dude you saved my ass!

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