flash/actionscript 3 question

Discussion in 'Techforge' started by Ebeneezer Goode, Mar 5, 2007.

  1. Ebeneezer Goode

    Ebeneezer Goode Gobshite

    Joined:
    Mar 28, 2004
    Messages:
    19,127
    Location:
    Manchester, UK
    Ratings:
    +8,259
    anyone know how you do the following AS2 code in AS3?

    Code:
    this.watch("wtcTest", setTest);
    
    function setTest(prop, oldval, newval, userData){
        _root.txtTest.text="Boohoo";
        return newval+"!";
    }
    
    wtcTest.text="OMG!";
    
    i know to change '_root' to 'Stage', but they seem to have got rid of 'object.watch' :weep:
  2. Camren

    Camren Probably a Dual

    Joined:
    Mar 29, 2004
    Messages:
    4,201
    Location:
    London, UK
    Ratings:
    +902
  3. Ebeneezer Goode

    Ebeneezer Goode Gobshite

    Joined:
    Mar 28, 2004
    Messages:
    19,127
    Location:
    Manchester, UK
    Ratings:
    +8,259
    i think i've figured out an alternative...

    just chucking data from a c# form into flash and wanting to make sure its going there.
  4. Seth Rich

    Seth Rich R.I.P.

    Joined:
    Jan 9, 2005
    Messages:
    2,387
    Location:
    Hillary's Hit List
    Ratings:
    +1,417
    You have to use the ChangeWatcher class now I think.

    If I'm reading it right, you'd have to do something like this:

    Code:
    import mx.bindings.utils.ChangeWatcher;
    
    ...
    
    var cw:ChangeWatcher = ChangeWatcher.watch("wtcTest", "text", setTest);
    
    function setTest(){
       someObject.txtTest.text = "Boohoo";
    }
    
    wtcTest.text = "OMG";
    
    • Agree Agree x 1
  5. $corp

    $corp Dirty Old Chinaman

    Joined:
    Mar 29, 2004
    Messages:
    15,867
    Location:
    Calgary, Alberta
    Ratings:
    +7,101
    Holy Shit! You guys are hard-core. I think I know how to do a rollover and make something open in another window.
  6. Ebeneezer Goode

    Ebeneezer Goode Gobshite

    Joined:
    Mar 28, 2004
    Messages:
    19,127
    Location:
    Manchester, UK
    Ratings:
    +8,259
    damn, flash 9 isn't recognizing ChangeWatcher, which is odd since it should be the same engine as Flex or near as damn :weep:
  7. Seth Rich

    Seth Rich R.I.P.

    Joined:
    Jan 9, 2005
    Messages:
    2,387
    Location:
    Hillary's Hit List
    Ratings:
    +1,417
    Well damn :(

    Only thing I can think to do is download the Flex 2 SDK and point your Flash project Classpath to the source folder (path should look like <wherever you unzipped the SDK>\frameworks\source). That might work.

    (Never worked in Flash 9, so not sure how this will work.)