A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: tell target with variable

  1. #1

    Thumbs down

    hi,
    is it possible to make a tell target containing a variable, i mean that target movie clip is designated by a variable. And how could it be wrritten ?

    thanks in advance.

  2. #2
    [Devil in DarkGreen]

    Join Date
    Aug 2000
    Posts
    523
    if you use flash 5
    for a mc in main scene instance name is "a"
    there is a var is "b"

    _root.a.b=c;

    that is ok

    A D.S


  3. #3
    thank you for so a quickly response !
    unfortunaly i'm working on flash 4 and i don't know if _root will be understood cause i'll never heard about it. So you show me how to use it, but could you explain me in which case you use what is for me a new function (and its syntax)?

    thanks

  4. #4
    Senior Member
    Join Date
    Aug 2000
    Posts
    2,235

    target

    I wrote in only last night about this, but got not replys, however I got it figured out. If you be more specific I may be able to help you out. cheers mgb

  5. #5

    re-target

    hi,
    so... the background :
    i have different swf and each one of them's containing a different sound. Those different movies could be charged on my main scene using a load movie with variable (variables areloaded from a text file)(...the user can chose the sound).

    on my main scene i've got a mc containing a buton to control (start and stop) the sound.

    the problem :

    to interact on sound with the buton in the control mc i want to use a "tell target" action with a "goto".
    but the swf files have different names.So i think i have to put a variable in the tell target action, which refers to the sound mc name...

    am i clear ? not sure


  6. #6

    Smile have i got it ? perhaps...

    i thougt to it just after posting my novel

    the swf files with sound could all have the same instance (occurency), no matter with the name is. So i can forgot the "tell target" with a variable...

    for this time, because i still wonder if it's possible to put a variable in the "tell target" and how could it be writen ?

    1001 thanks

  7. #7
    Senior Member
    Join Date
    Aug 2000
    Posts
    2,235

    Re: re-target

    To use the variable as tell target you need to find out what the variable is and load the corrosponding .swf
    Use something like this.

    If (myvariable=1)
    load movie .swf 1
    Else if (myvariable=2)
    load movie .swf 2
    Else if (myvariable = 3)
    load movie .swf 3


    or

    If (myvariable=1)
    Tell target
    mc1
    play
    End tell target
    Else if (Myvariable =2)
    Tell target
    mc2
    Play
    End tell target

    etc.


    [Edited by mgb on 10-20-2000 at 07:36 PM]

  8. #8
    Member
    Join Date
    Aug 2000
    Posts
    45
    Yes, you can target it with variable
    Ecample : (all this works for me)
    Code:
    Set Variable: "ani"&i&"/font:text" = Substring ( text, i, 1 )
    Set Property ("ani"&i, X Position) = getproperty("ani0",_x)+space*i
    If, for example, i=1, then the first action wil target ani1/font, while the second one will target ani1

  9. #9

    thanks for all... and just one more.

    And there was light !

    with your help i understand how to make a tell target with a variable. But i've got a large choice of swf, so, if i verify the condition with an "if" i should have a water fall of it, and that could make the size heavier.
    "If" i well understand, could i have a script like this ?

    Load Variables ("test.txt", 0)
    Set Variable: "s" = sound
    Load Movie (s&".swf", 0)

    assuming sound looks like sound=2 or any other number .

    thanks a lot

  10. #10
    Member
    Join Date
    Aug 2000
    Posts
    45
    Assuming sound=2, then the action
    Code:
    Load Movie (s&".swf", 0) 
    Set Variable: "s" = sound
    will load the movie 2.swf

    Well Done,


  11. #11

    Smile thank you very much

    thank's for all this help !
    i began to better understand why, how and when using variables grace to you and everybody using this forum...

    a nice and great place !

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