A Flash Developer Resource Site

Results 1 to 19 of 19

Thread: Please gotoAndPlay prevScene !

  1. #1
    Member
    Join Date
    Jul 2010
    Posts
    61

    resolved Please gotoAndPlay prevScene !

    I made a thread like this about one month ago . But I don't take a correct answer . I repeat that again . Please help me !

    The code I want is :

    - gotoAndPlay Frame 2 of prevscene

    That's it only !
    Professional WebDesigner_HTML, CSS, JS, PHP

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    Yes, the previous answer was incorrect. You will need a label to target that frame.

    So, put a label on that keyframe via the frame properties panel. Then the action will be:

    _root.gotoAndPlay("labelname");

    gparis

  3. #3
    Member
    Join Date
    Jul 2010
    Posts
    61
    Thanks a lot ,

    But this AS code only work when the frame label is on root . How I should put instead of _root for other scenes ? For example how I should write when my frame label is in to a MovieClip ?

    Thanks again ,

    > Farzad
    Professional WebDesigner_HTML, CSS, JS, PHP

  4. #4
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    First you get to the desired scene with a frame labeled on root, then once the playhead is on that labeled frame, you ask the movieclip to get to whichever frame you need.

    gparis

  5. #5
    Member
    Join Date
    Jul 2010
    Posts
    61
    So why I should use Frame Label ? Can it work with frame number ? Also I don't your purpose yet . Sorry , but can you give me a FLA file that show what you say ?

    Thanks ,

    > Farzad
    Professional WebDesigner_HTML, CSS, JS, PHP

  6. #6
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    Only use labels when working with Scenes. If Scene 1 has 10 frames, the frame # 2 of Scene 2 is actually frame # 12. You can get lost easily, plus you need a label from a nested clip to target _root. You don't need someone to give you a fla to understand that. Test it yourself?

    gparis

  7. #7
    Member
    Join Date
    Jul 2010
    Posts
    61
    Thanks ,

    I know that is easy , but you should know my English is not so good for understand your means . So I share my FLA file : Please let me know what is incorrect . I want timeline go to the frame 2 of scene 2 . Thanks .

    My FLA file
    Professional WebDesigner_HTML, CSS, JS, PHP

  8. #8
    Member
    Join Date
    Jul 2010
    Posts
    61
    Sorry for post again , do you check my FLA file ?
    Professional WebDesigner_HTML, CSS, JS, PHP

  9. #9
    Member
    Join Date
    Jul 2010
    Posts
    61
    Hi gparis , Can you send me a new answer ?
    Professional WebDesigner_HTML, CSS, JS, PHP

  10. #10
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    Hi,

    In order for me to check your file, you'll need to convert to a CS4 compatible version and attach it to your post instead.

    gparis

  11. #11
    Member
    Join Date
    Jul 2010
    Posts
    61
    Thank you . It's the CS4 version of my file .

    Download CS4 Version

    ................................
    Professional WebDesigner_HTML, CSS, JS, PHP

  12. #12
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    please attach it to your post instead.

    gparis

  13. #13
    Member
    Join Date
    Jul 2010
    Posts
    61

    resolved

    I gave you a link , But , no problem . I attach it . Thanks

    > Farzad
    Attached Files Attached Files
    Professional WebDesigner_HTML, CSS, JS, PHP

  14. #14
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    Giving an instance name to the movie clip will allow you to target it from another timeline.

    I also changed the gotoAndPlay() to a gotoAndStop() since you have a stop() on the labeled frame and no other subsequent frames to allow playing.

    I put the label on the empty keyframe, instead of on the keyframe that holds content.

    See attached.

    gparis
    Attached Files Attached Files

  15. #15
    Member
    Join Date
    Jul 2010
    Posts
    61
    Thanks so much , it works . Now I understand how its work .
    Thanks again ,

    > Farzad
    Professional WebDesigner_HTML, CSS, JS, PHP

  16. #16
    Member
    Join Date
    Jul 2010
    Posts
    61

    Re

    That file work right . But when I test it in my project , I found a new problem . My frame was in a MovieClip and I want that go to Frame 2 or Prevscene . Now I give you a new FLA file . Maybe you can help me like that time .

    Thanks so much ,

    > Farzad
    Attached Files Attached Files
    Professional WebDesigner_HTML, CSS, JS, PHP

  17. #17
    Member
    Join Date
    Jul 2010
    Posts
    61
    Hi , this thread go in button , so I post a new reply .
    Please check my new FLA file .
    Professional WebDesigner_HTML, CSS, JS, PHP

  18. #18
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    The object you talk to has to be present to hear you.

    see attached.

    gparis
    Attached Files Attached Files

  19. #19
    Member
    Join Date
    Jul 2010
    Posts
    61
    Thanks a lot ! It work correct and I use it in my project . You give me a big help , really !

    Thanks again ,

    > Farzad
    Professional WebDesigner_HTML, CSS, JS, PHP

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