Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Play backwards while holding button

  1. #1
    Join Date
    Nov 2006
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Play backwards while holding button

    Hi folks
    I have a simple but disheartingly frustrating task that I would like to achieve. But since I am a bloody noob, grrrr....
    Ok have a look here:
    http://www.binarylooks.com/projects/...lery/index.php

    The top panel with the thumbs is what concerns me.I want the left button to scroll it back and the right button to scroll it forward. The thumbs panel is a simple movie with two keyframes to make it move.
    The right arrow says something simple like:
    Code:
    on(press) {
    play();
    }
    on(release) {
    stop();
    }
    For the back button, it is more problematic.
    I tried:
    Code:
    on(press) {
    for (i=panel._currentframe; i>0; i--) {
    gotoAndStop(i);
    }
    As you see, it does not work smoothly.
    I tried googling it, and it seems thaht this is a common frustration. Sadly, I did not find an easy answer.
    Somebody has solved this particularly problem?

    Thanks

  2. #2
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Here is a very simple tutorial on playing the time line backwards.

    Note that is using onEnter(load) which will rewind at current FPS. If you need it to go faster you will have to use setInterval instead.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  3. #3
    Join Date
    Nov 2006
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile

    Thanks BLiZZaRD for the quick answer
    I'll check it out tonight.

  4. #4
    Join Date
    Nov 2006
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ok, Ij ust had look at it but have not tested it yet. Here is the code mentioned at the link. (Ok, I know I should work when at work but the net is just stronger :-)):
    Code:
    backward=0;
    function goBack(){
      _root.onEnterFrame=function(){
    	if(backward==0){
    		nextFrame();
    		textField.text="forward";
    	}
    	if(backward==1){		
    		prevFrame();
    		textField.text="backward";		
    	}
      }		
    }
    goBack();
    1) Right now I wonder where the "one frame after the other" comes from. Is it the onFrameEnter? As soon as he enters a new frame he is told to go back one frame which atutomatiocally calls the onFrameEnter again?. I tried to achieve this with the for loop but it was too fast obviously.
    2) Ok, so I will use:
    Code:
    onPress() {_root.onFrameEnter....}
    and onRelease {stop();}
    probably the stop command is not even needed. Is this correct?
    Last edited by belsidaam; 12-14-2006 at 11:00 AM. Reason: typos

  5. #5
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Not quite.

    You will write this function (here called "goBack") in your scripts layer or such.

    Then on your buttons you will simply use:

    Code:
    on(press){
       goBack();
    }
    You can add on(release) and on9mouseOver) if you wish to add more elements to it, but it shouldn't be needed.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  6. #6
    Join Date
    Nov 2006
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Yes, of course. Much cleaner. Stupid me

  7. #7
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Note that I have never used play back from with in my own movies, so this is all hearsey. If you have any problems though, the code is straight forward enough, just ask and I should be able to get an answer for you
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  8. #8
    Join Date
    Nov 2006
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up Question resolved. Thanks

    Thanks a lot BLiZZARD It worked perfectly fine.
    Here's the final movie.

  9. #9
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Very nice! I like it a lot! Just one tiny little thing (asthetics mostly)

    When scrolling left and right do you think you could/should put some sort of stop notice on the far edges?

    even a left/right arrow on the respective end something like:

    >> [][][][][][][] <<

    One little "usability problem" is that the arrows are active regardless of where the menu is, so I try to push the left arrow and nothing happens. likewise if I am at far right I can continue to push the right arrow and nothing happens.

    If visitors had a visual "end of film" type notice it would help, asthetically speaking.

    Just an idea.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  10. #10
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    One other thing... noticed your "Does not work with IE" at the top. You can correct this very easily.

    First download the file attatched. inside are 2 JS files, in a folder named "scripts" upload that folder to your root directory, as is. no need to edit the files at all.

    then find this area in your source:

    Code:
    	<div style="margin-left:100px;">
    	<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="503" height="578" id="anjagallery" align="middle">
    <param name="allowScriptAccess" value="sameDomain" />
    <param name="movie" value="anjagallery.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ece9d8" /><embed src="anjagallery.swf" quality="high" bgcolor="#ece9d8" width="503" height="578" name="anjagallery" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
    </object>
    
    </div>
    And replace it with this:

    Code:
    	<div style="margin-left:100px;">
            <noscript>
    	<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="503" height="578" id="anjagallery" align="middle">
    <param name="allowScriptAccess" value="sameDomain" />
    <param name="movie" value="anjagallery.swf" />
    <param name="quality" value="high" />
    <param name="bgcolor" value="#ece9d8" />
    </object></noscript>
    <script language="JavaScript" type="text/javascript" >
    <!--
    AC_RunFlContentX ("movie", "anjagallery", "quality", "high", "src", "anjagallery", "width", "503", "height", "578" );
    //-->
    </script>
    </div>
    then add this inside your <head></head> tags:

    Code:
    <script src="/scripts/AC_RunActiveContent.js" language="JavaScript" type="text/javascript"></script>
    <script src="/scripts/AC_Flash.js" language="JavaScript" type="text/javascript"></script>
    Save and upload the HTML file to the server. Done deal. now it is valid HTML and will work with any IE and NS browser 5.5 or higher.

    For future reference on how this is done bookmark this link:

    http://learningflashmx.com/fix_activex.htm

    also note as long as you have this line:

    Code:
    <param name="movie" value="anjagallery.swf" />
    You can remove the <embed...blah blah /> tag from the code
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

Bookmarks

Posting Permissions

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