dcsimg
A Flash Developer Resource Site

Results 1 to 19 of 19

Thread: A tip for those new to Flash MX

  1. #1
    Senior Member
    Join Date
    Sep 2000
    Posts
    273
    Since Flash is becoming insanely object oriented, you should make some slight adjustments to your coding style in order to take full advantage of this fact.

    When you are creating names for your objects, make sure to use to following naming conventions in order to take full advantage of the code hints that are programmed into Flash MX.

    _mc == MovieClip
    _array == Array
    _str == String
    _btn == Button
    _txt == TextField
    _fmt == TextFormat
    _date == Date
    _sound == Sound
    _xml == XML
    _xmlsocket == XMLSocket
    _color == Color
    _camera == Camera
    _mic == Microphone
    _stream == NetStream
    _connection == NetConnection
    _so == SharedObject
    _video == Video

    using the extensions on your objects names fully extends the codehints for your objects.

    For Example:

    if you have a movieclip named myClip, when you type out "myClip." nothing will pop-up (in comparison to typing "_root." when it displays a list of all the methods). If you instead name your clip myClip_mc, then when you type "myClip_mc." it pops up a list of all methods just like it does for language objects (like root).

    Spyder

  2. #2
    Senior Member
    Join Date
    Mar 2000
    Posts
    111
    nice tip, good ludicrous sig also

  3. #3
    Senior Member
    Join Date
    Apr 2001
    Posts
    251
    Good to know, thanks a bunch!

  4. #4
    caithness massiv
    Join Date
    May 2000
    Location
    denver
    Posts
    1,672
    to extend on this point, you can actually place all of your code on one frame now and prototype your way through the entire .swf

    like this:


    someinstancename_mc.onEnterFrame = function(){...}

    someinstancename_mc.onPress = function(){...}

  5. #5
    Senior Member
    Join Date
    Mar 2000
    Posts
    111
    better and better,
    how long before we see a proto 3d cube script posted on this board I wonder? I'm betting later today.

    // this post is just a feeble excuse to celebrate my finally reaching 100 posts (in 2 years!)

  6. #6
    Information Architect Subway's Avatar
    Join Date
    Feb 2000
    Location
    Switzerland
    Posts
    4,779
    Yeah, thats nice. i allready started to code everything on the first frame. No more control mc's and ugly things like that.

    Fredi

  7. #7
    Retired Mod aversion's Avatar
    Join Date
    Jun 2000
    Location
    insomnia
    Posts
    7,917
    Originally posted by angstrom
    better and better,
    how long before we see a proto 3d cube script posted on this board I wonder? I'm betting later today.
    i wanna see the source for thi: http://www.bit-101.com/wh/test%202.swf


    hint hint bit!


  8. #8
    Against the Wind.....
    Join Date
    Dec 2000
    Posts
    62
    Whoa that is so useful, now I'm gonna start re-doing some of my old project with this...

  9. #9
    Information Architect Subway's Avatar
    Join Date
    Feb 2000
    Location
    Switzerland
    Posts
    4,779
    Originally posted by aversion
    i wanna see the source for thi: http://www.bit-101.com/wh/test%202.swf
    Originally posted by tyard at were-here
    Well, I've got the clipping working-- thanks, Somar, for the direction and equations. The library is pretty much complete, it just needs some optimization of the code. As soon as I get my hands on MX and get it working with the actual new methods (plus investigate whether any other methods might be of use), I'll document it and put up samples. Anyone wishing can then download it and have at it. Any modifications and optimizations reported to me I can add to the downloadable version. So far the methods (the Flash3D object holds the latter three):


    //___________FLASH3D methods______________
    /*
    newModel();
    translate();
    rotate();
    getLens();
    setLens();
    render();
    getCoor();
    setCoor();
    deleteModel();
    reset();
    getFocalLength();
    setFocalLength();
    */

    //___________primitive methods______________
    /*
    newMesh();
    setHeight();
    setWidth();
    setLength();
    */

    //___________Model methods______________
    /*
    addVertex();
    addVertices();
    assignSide();
    getVertexList();
    createVGroup();
    translate();
    rotate();
    transform();
    scale();
    getFill();
    setFill();
    makePrimitive();
    getRenderMode();
    setRenderMode();
    getLineStyle();
    setLineStyle();
    */

    //___________Light methods______________
    /*
    translate();
    rotate();
    transform();
    getBrightness();
    setBrightness();
    transform();
    */
    here's the link: http://www.were-here.com/forums/show...8&pagenumber=4

    An other thing to wait for.

    Fredi

  10. #10
    Get Squared Away.
    Join Date
    Feb 2000
    Location
    Allentown, PA
    Posts
    543
    Originally posted by agent vivid


    someinstancename_mc.onEnterFrame = function(){...}

    someinstancename_mc.onPress = function(){...}

    Can you expand on this a bit? I'd have no idea how to do it. You mean you can have all your code for all your movie clips on the first frame of your movie? Is there an example .fla?

  11. #11
    Junior Member
    Join Date
    Mar 2002
    Posts
    1

    source code

    i wanna see the source for thi: http://www.bit-101.com/wh/test%202.swf
    hint hint bit!
    Well you could always knock the file off the end of the URL to get...
    http://www.bit-101.com/wh/

    I believe the .fla is in there

    Hope this helps,
    Modesty
    xxxx

  12. #12
    caithness massiv
    Join Date
    May 2000
    Location
    denver
    Posts
    1,672
    yes... it is quite possible (and very valuable) to code your entire swf in one frame


    to create a 'method' for your object, simply do it like i said:


    movieclip.eventHandler = function(){ your code here }


    so... here's some actual code using this methodology:

    Code:
    levels_mc.onEnterFrame = function(){
    this._yscale = 16*_root.myMic.activityLevel;	
    }

    pretty easy... and like fredi said, this gets rid of the need for controller clips and code spread out accross the stage

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

    as for the 3dapi, check out the drawing api thread at were-here

    http://www.were-here.com/forums/show...5&goto=newpost

  13. #13
    caithness massiv
    Join Date
    May 2000
    Location
    denver
    Posts
    1,672
    i also forgot to mention that you can pass methods along to other clips


    so, if i wanted another clip to behave as one i have already scripted, i can just set them equal

    for instance:

    Code:
    //create a new method
    levels_mc.onEnterFrame = function(){
    this._yscale = 16*_root.myMic.activityLevel;	
    }
    //pass the method
    levels2_mc.onEnterFrame = levels_mc.onEnterFrame;

  14. #14
    Information Architect Subway's Avatar
    Join Date
    Feb 2000
    Location
    Switzerland
    Posts
    4,779
    Originally posted by agent vivid
    and like fredi said, this gets rid of the need for controller clips
    Thx god! I just searched for the controling MC in a game that I done first and a friend changed all things to use it for a specific client. The funny thing was that I found the code on a moviecliped line (one line under about ten similar lines and a lot of other gfx) after i searchd for it about 1/2 hours.

    Fredi

  15. #15
    caithness massiv
    Join Date
    May 2000
    Location
    denver
    Posts
    1,672
    lol...

    why didn't you use the movie explorer


    neway, i'm soooooo glad that MX is OOP... it makes for a much cleaner delivery and a much easier workflow

  16. #16
    Information Architect Subway's Avatar
    Join Date
    Feb 2000
    Location
    Switzerland
    Posts
    4,779
    I used the mc-explorer, but I deleted all this lines bevor (during a redesing process) I never thought that the aS would be on a line in the middle of a lot of other gfx and clips.



  17. #17
    Hey!

    Hm.. Damn I feel like a coplete morron.
    My first oop started with pascal! I've made lot's of things with objects, than I moved to delphi and there I sort of stopped dig into the oop (it was so intuitive, no need to know how those classes worked). Than I moved to flash and php. For this work I do I don't need objects at all.

    I consider myself as advanced developer, specially in flash5, but now with FMX? I am totally lost.

    I have to tell you I am very, very excited of all possibilities the fmx is offering me now. Just with dynamically jpg loading was enough for me.

  18. #18
    Information Architect Subway's Avatar
    Join Date
    Feb 2000
    Location
    Switzerland
    Posts
    4,779
    OOP isn't that big issue in MX. MX-AS was just the logical step. No big things to learn. You can still code like in Flash 5. No need to be scared about OOP in MX, really.

    Fredi

  19. #19
    I am not scared - I am just so excited!

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