dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Dynamically generated scene names and frame labels

  1. #1

    Dynamically generated scene names and frame labels

    Hi there

    I need some help on how to gotoAndPlay a scene...with a twist.

    If I have dynamically generated a frame label and a scene name, how would I reference these in an on(release); action ?

    i have a 3 separate scenes called for eg.
    scene1, scene2, scene3, etc.

    within these scenes are 3 frame labels called for eg.
    label1, label2, label3 etc.

    my code then generates a random scene name and a random frame label. the generated scene name in the code is refered to as 'theQuestion' and the generated frame label is referred to as 'arrQuestion[rndNum]'

    so on release when clicking a button i would like to go and play the generated frame label within the generated scene.

    on(release){
    gotoAndPlay(theQuestion,arrQuestion[rndNum]);
    }

    doesn't work. the scene has to be written as a string, so how do i get around this problem?

    i hope i've made some kind of sense with this.

    please help

    e

  2. #2
    HELP>>>ACTIONSCRIPT DICTIONARY
    Join Date
    Feb 2000
    Location
    In the Present Moment
    Posts
    1,041
    Well I stay away from using Scene names (particularly because of this very issue, among others). They are pretty much used by me for visually organizing the movie in the authoring environment. When a movie is published all scenes are put into one giant timeline anyway. If you make sure that each labled frame, across scenes, is unique you then only have to target a particular frame label.

    The best way is to just uniquely name the frames (as it appears that you have) then the gotoAndPlay action, without the scene reference, should work fine. (As long as the path to that array is correct.)

    Good Luck!
    Antibody
    "Our deepest fear is not that we are inadequate.
    Our deepest fear is that we are powerful beyond measure." - N. Mandela

  3. #3
    hi there

    thanks for replying. I decided to try that and magically it worked, but now i know why from your explanation so cheers.

    e

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