A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Data from shared object - using elsewhere

  1. #1
    Junior Member
    Join Date
    Aug 2000
    Posts
    3

    Data from shared object - using elsewhere

    Hi all,

    I have a dynamic text field on the stage which loads the data from my shared object (a word). This works great but I'd like to get my movie to jump to a certain label depending on what that word is. For example if the shared obeject puts "Jump" into the dynamic text field I'd like the movie to jump to the label "Jump".
    I have tried a number of ways to do this including using an "if" statement etc, but can'tget it to work.
    Do I need to convert my data (which is a string) into a variable or something before I can make the jump or is there a easier way.


    __________________
    Thanks in advance

    Sambora

  2. #2
    Senior Member
    Join Date
    Nov 2000
    Location
    Jerusalem, Isreal
    Posts
    254

    I'm not sure i got it right, but...

    it all depends on where you textField is on the timeline (_root, or sub MC), but anyhow, what you need to do is to tell flash to go to the frame lable which is the samwe as your "object".
    let's say your word is "jump" - write this:

    gotoAndPlay(word);

    make sure you write the name of the object and not the value of it (in this case, don't write "jump", got me?

    good luck.
    Matti Bar-Zeev,
    scriptaholic.

  3. #3
    Senile member! :)
    Join Date
    Dec 2001
    Location
    Saunaswamp (transl)
    Posts
    2,296
    No, you should just be able to feed the string straight to the goto. Since they work with strings there shouldn't be any need to convert it.

    just make sure that the label is unique and that they are spelled rigth(I don't think case matters though).

    Here are some examples. The word is presumed to be stored in label inside the shared object.

    example 1:
    Code:
    myTextField.text = mySO.data.label;
    
    gotoAndPlay(myTextField.text);
    example 2:
    Code:
    myTextField.text = mySO.data.label;
    
    gotoAndPlay(mySO.data.label);
    example 3:
    Code:
    gotoAndPlay(myTextField.text = mySO.data.label);
    /Mirandir

  4. #4
    Junior Member
    Join Date
    Aug 2000
    Posts
    3
    Thanks for your help guys, but it was just me being stupid!! I've fixed it now.
    Just forgot to use "==" when checking the string in the if statement I was using "=".

    Thanks again!


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