• English (17)
  • Bahasa Indonesia (17)
  • Page 1 of 912345»...Last »

    Display Objects

    Posted by Paulus T on Jan 6th, 2008
    2008
    Jan 6

    Big changes in ActionScript 3.0 are about handling and working with display objects. While ActionScript 2.0 we only knew MovieClip, Graphic and Button, now there are additional display object instances as :
    - Sprite (just alike MovieClip but without frame inside it)
    - Shape (alike the Sprite, minus the mouse and keyboard interactive)
    - Bitmap (only to displays bitmap)
    - Loader (as a container for loaded content like SWF or images(bitmaps)

    And as previously, each display objects hold properties we can access through our script. ActionScript 3.0 still have the properties we used to know, but have slight changes in the naming, mostly are the name that using underscore like _x, _y, _width, _height, etc and now simply x, y, width, height, etc. Some of this properties are not only changed in naming, but also how the value represent. For example :

    //ActionScript 2.0
    mymovie._x = 100;// x position value = 100
    mymovie._xscale = 200;// x scaling to 200%
    mymovie._alpha = 10;// alpha channel to 10%
     
     
    //ActionScript 3.0
    mymovie.x = 100;// x position value = 100
    mymovie.xscale = 2;// x scaling to 200%
    mymovie.alpha = 0.1// alpha channel to 10%

    For button symbols now are instances of a new class, SimpleButton and Graphics become Shape. And dynamic text become instances of TextField. ActionScript 3.0 now will not allow us to place code inside Button or MovieClip. All code must be written in timelines or sepparate ActionScript files.

    Classes

    Posted by Paulus T on Jan 6th, 2008
    2008
    Jan 6

    In ActionScript there are sealed class and dynamic class. And in ActionScript 2.0, sealed class enforcement were only handled by the compiler. Which mean we still can do some workaround the restriction using array access operator to reference variables. For example :

    var mysound:Sound = new Sound();
    mysound['myownvalue'] = 2;

    In ActionScript 3.0, we can not longer do that workaround. Sealed classes enforced are not only in compile time, but also in runtime. So we must note which objects are dynamic and which are not. And here is the list of dynamic classes that commonly used :
    - Array
    - Object
    - Date
    - Dictionary
    - Error
    - MovieClip
    - RegExp
    - StyleSheet
    - URL Variables
    - XML and XMLList

    Page 1 of 912345»...Last »