A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: 'tell target,' what replaced it?

  1. #1
    Junior Member
    Join Date
    Mar 2002
    Posts
    16
    I know it is still there, however, if macromedia put it in the depreciated actions folder then they must have some new action or way of doing the same thing in mx. Does anyone know what replaced 'tell target?'

    Thanks

  2. #2
    Moderator enpstudios's Avatar
    Join Date
    Jun 2001
    Location
    Tampa, Fl.
    Posts
    11,282
    _root ?

  3. #3
    -------------
    Join Date
    Feb 2002
    Posts
    39
    tell-target was deprecated in the flash 5.
    Look into 'dot-syntax'.
    eg. _root.mcinstancename._property

  4. #4
    Junior Member
    Join Date
    Mar 2002
    Posts
    16
    Thanks.

  5. #5
    Senior Member
    Join Date
    Sep 2000
    Posts
    298
    The basic Idea here is you don't need to use the lengthy tell target actions any more. example:

    tellTarget ("mymovie") {
    gotoAndPlay(10);
    }

    can be replaced with...

    mymovie.gotoAndPlay(10);

    for deeper nesting, i.e. a dynamic text field with the variable textBlock, which is inside a movieclip called myMovie, if you want to change the value to fred can be done like this.

    myMovie.textBlock = "fred";

    and for calling instances outside of your current clip: if your actionScript is inside a movie clip called MC1 and you want to change a variable (textBlock1) in a movie clip(MC2) that is in the main timeline. you could use this

    _root.MC1.textblock1 = "fred";

    Now I also suggest using the new text object features to manipulate dynamic text fields but that is a diff. discussin entirely.

    let me know if this doesn't make sense and I will send you an example .fla.

  6. #6
    Senior Member
    Join Date
    Mar 2002
    Posts
    334
    I thought that in Flash 5 tellTarget was phased out in favor of with()
    like

    with(myMovie)
    {
    gotoAndPlay(1);
    }

  7. #7
    Junior Member
    Join Date
    Mar 2002
    Posts
    21
    Originally posted by Squareball2
    I thought that in Flash 5 tellTarget was phased out in favor of with()
    like

    with(myMovie)
    {
    gotoAndPlay(1);
    }
    If you want the most literal translation from ActionScript's tellTarget to ECMAScript, "with" is it.

    To me, "with" is more of a half-assed function. It provides a minimal amount of time saving with less reusability than a function (or method if in an object). There are no situations where I would use "with" over regular "dot" syntax.

    skip
    [Edited by skipintro on 03-19-2002 at 11:31 AM]

  8. #8
    Senior Member
    Join Date
    Mar 2002
    Posts
    334
    Yeah I never even used with

    I always just targeted with the dot syntax. Never understood why you would bother using with instead of tellTarget though. My room mate only knows how to use tellTarget and then he read that he should use with instead.. and I asked "why"... he said "I dunno" hehe
    I mean it seems like the same thing to me..
    is there a difference other than standards psuedo compliance?

  9. #9
    Junior Member
    Join Date
    Mar 2002
    Posts
    21
    Originally posted by Squareball2
    Yeah I never even used with

    I always just targeted with the dot syntax. Never understood why you would bother using with instead of tellTarget though. My room mate only knows how to use tellTarget and then he read that he should use with instead.. and I asked "why"... he said "I dunno" hehe
    I mean it seems like the same thing to me..
    is there a difference other than standards psuedo compliance?
    Standard's compliance IS the reason. While most "deprecated" items will never be REMOVED from ActionScript, you are more likely to confuse someone in the future if you use one. tellTarget is a Flash specific convention which uses the "/" path format. It existed in Flash 4 and therefore needed to be supported fully in Flash 5. Instead of translating tellTargets to "with" automatically they just suggest "with" as the ECMAScript standard alternative.

    It's all about what people expect to see.

    skip

  10. #10
    Senior Member
    Join Date
    Mar 2002
    Posts
    334
    cool thanks for the info I was wondering about that

  11. #11
    Senior Member dlowe93's Avatar
    Join Date
    Aug 2001
    Location
    Stumptown
    Posts
    621
    Originally posted by Squareball2
    Yeah I never even used with
    I mean it seems like the same thing to me..
    is there a difference other than standards psuedo compliance?
    the main advantage with "with" is that you can use it to do many things to one clip at the same time. for example you could do something like this:

    on(release){
    with (_root.myClip){
    _alpha=100;
    _x-=150;
    _y-=150;
    _xscale=100;
    _yscale=100;
    gotoAndStop("start");
    //add more properties and methods to your heart's delight;
    }
    }

    it just saves you having to write the name of the clip each time. it also comes in handy when writing functions that do multiple things to multiple clips.

    hope this helps.

    d.

  12. #12
    Junior Member
    Join Date
    Mar 2002
    Posts
    21
    Originally posted by dlowe93
    Originally posted by Squareball2
    Yeah I never even used with
    I mean it seems like the same thing to me..
    is there a difference other than standards psuedo compliance?
    the main advantage with "with" is that you can use it to do many things to one clip at the same time. for example you could do something like this:
    I agree that the intent is to allow this, however I still contend that whatever you are using it for would be better served as an object or a method of an object. The "with" construct, in my mind, violates OO methodology.

    For your example instead of having that code in that on ( release ) you could do this:

    <PRE>
    function __naturalize()
    {
    this._alpha=100;
    this._x-=150;
    this._y-=150;
    this._xscale=100;
    this._yscale=100;
    this.gotoAndStop("start");
    //add more properties and methods to your heart's delight
    }
    </PRE>

    Then, if you wanted all movie clips to have this property you could:

    MovieClip.prototype.naturalize = __naturalize;

    Then usage would be:
    <PRE>
    on ( release )
    {
    _root.myClip.naturalize();
    }
    </PRE>

    The same method could be added to buttons, textfields, or by adding it to the Object.prototype you could give all objects that method (though for this example that's not the best case)

    skip


    [Edited by skipintro on 03-19-2002 at 01:56 PM]

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