A Flash Developer Resource Site

Results 1 to 18 of 18

Thread: Deprecated Syntax???

  1. #1
    caithness massiv
    Join Date
    May 2000
    Location
    denver
    Posts
    1,672
    so what's the deal with deprecated syntax and this new release???

  2. #2
    World Kit Vote Holder Abelius's Avatar
    Join Date
    Feb 2002
    Location
    US
    Posts
    963
    Already impatient, eh?

    Well, did you see the list of deprecated items from Flash 4 to 5?

    <>
    and
    or
    not
    ifFrameLoaded
    int
    random
    and all the String functions...

  3. #3
    caithness massiv
    Join Date
    May 2000
    Location
    denver
    Posts
    1,672
    it's hard NOT to be impatient

    yeah... but i was actually wondering if the new player supports anything coded with older flash4 deprecated coding (jeez... if it doesn't, then lots of people will get pissed)

    also, if MX auto-updates the code like 4>5 did

    and also if there's anything new on the list of deprecated syntax that we should watch out for

  4. #4
    curmudgeon swampy's Avatar
    Join Date
    Jan 2001
    Location
    [wakey]
    Posts
    2,775
    I read a post earlier somewhere by flashguru saying that it is supported for backward compatability

  5. #5
    [Devil in DarkGreen]

    Join Date
    Aug 2000
    Posts
    523
    yea.all these code are not supported any more,cause they are garbage code now.


    DS

  6. #6
    caithness massiv
    Join Date
    May 2000
    Location
    denver
    Posts
    1,672
    WOW demons !!!

    i haven't seen you in ages


    how's life ???

  7. #7
    Gross Pecululatarian Ed Mack's Avatar
    Join Date
    Dec 2001
    Location
    UK
    Posts
    2,954
    The depreciated F4 AS still works in MX.

  8. #8
    caithness massiv
    Join Date
    May 2000
    Location
    denver
    Posts
    1,672
    ed

    do you know if there's any additions to the deprecated syntax???


    also, is it still 'supported' like it is in flash5

    for instance, in flash 5 the random() function is deprecated because Math.random() is much more powerful... but i can still use it if i want


    do you know if this is still the case?

  9. #9
    Gross Pecululatarian Ed Mack's Avatar
    Join Date
    Dec 2001
    Location
    UK
    Posts
    2,954
    The depreciation is the exact same in MX, same things depreciated, still supported. Just the same.

  10. #10
    Moderator CNO's Avatar
    Join Date
    Jun 2000
    Location
    Brooklyn, NY
    Posts
    3,446
    OK, has anyone run any tests to see if there is a speed difference? (Some of the "depreciated" syntax was faster than the newer F5 methods - is this still the case?

  11. #11
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi CNO,

    I guess it still is ... F4 actionscript like random() is compiled into a bytecode at publish time, while a call to Math.random() causes two runtime lookups, one for Math and one for random. These extra lookups form the basis for OO and extensibility, however

    Musicman

  12. #12
    Gross Pecululatarian Ed Mack's Avatar
    Join Date
    Dec 2001
    Location
    UK
    Posts
    2,954
    And when you say Math.random() it sounds like you know a lot about programming..

  13. #13
    [Devil in DarkGreen]

    Join Date
    Aug 2000
    Posts
    523
    hi vivid

    i wanna discuss about random

    exactly, math.random() is more powerful and speedy then random()

    but random() is a useful in attaching movie or for loop
    how do u think?

    DS

  14. #14
    Moderator CNO's Avatar
    Join Date
    Jun 2000
    Location
    Brooklyn, NY
    Posts
    3,446
    Originally posted by Musicman
    Hi CNO,

    I guess it still is ... F4 actionscript like random() is compiled into a bytecode at publish time, while a call to Math.random() causes two runtime lookups, one for Math and one for random. These extra lookups form the basis for OO and extensibility, however

    Musicman
    Not saying I don't like the new stuff- don't get me wrong. But I was under the impression that the player itself had undergone some reworking, and was wondering if there was a significant difference anymore, particularly when using many objects at once...

    I suppose I'll have to wait to get my hands on the program and run some speed tests.

  15. #15
    [Devil in DarkGreen]

    Join Date
    Aug 2000
    Posts
    523
    hi,cno,please try flash mx
    it's a good vector painting stuff,the best painting feature is envelope transform



    DS

  16. #16
    caithness massiv
    Join Date
    May 2000
    Location
    denver
    Posts
    1,672
    @demons re: random() vs. Math.random()


    i have always thought that having these two commands around has actually been wonderful and i'm glad to hear that both are *hopefully* still supported

    i use the random() function heavily to bump the playhead randomly through the timeline... it's also nice to use if you randomly want to grab an entry from an array

    when you use Math.random() you have to actually do more steps to get the number back to a whole number, while random() naturally only returns whole numbers

    for instance, if i wanted to set up a 20% chance of occurance, i could simply say

    Code:
    if(random(5)==1){...}
    or i could say:

    Code:
    if(Math.random()<.2){...}


    BUT the instant i try to use a random number more to my advantage (i.e. as a frame number) i do this:

    Code:
    on(release){
         mc.gotoAndPlay(random(20));
         }

    but it takes more code to produce the same thing with Math.random():

    Code:
    on(release){
         mc.gotoAndPlay(int(Math.random()*20));
         }

    --------------


    @musicman
    These extra lookups form the basis for OO and extensibility, however


    could you explain this a bit more?

  17. #17
    Senior Moderator
    Join Date
    Apr 2000
    Location
    Sheffield, UK
    Posts
    3,881
    For the flash players interpreter to run this line of code:

    Code:
    mrn=Math.random()*20 //number between 0 + 19
    It has to run through this stack of bytecode:

    Code:
    push 'mrn', 0.0, 'Math'
    getVariable
    push 'random'
    callMethod
    push 20
    multiply
    setVariable
    Thats 7 lines of bytecode, bearing in mind thats some of the above commands are slower than others. Then this line of code:

    Code:
    mrn=random(20)
    Requires, the flash interpreter to run through a stack of 3 commands:

    Code:
    push 'mrn', 20
    random
    setVariable
    and it also uses the inbuilt random command in the player.

    Therefore the second syntax is an optimization but will only show great speed increases when used intensivley.

  18. #18
    Moderator CNO's Avatar
    Join Date
    Jun 2000
    Location
    Brooklyn, NY
    Posts
    3,446
    Wow, thanks for the detailed explination Guy. Looks like random() is still the way to go for games programming where random integers are called for.

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