-
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
-
nice tip, good ludicrous sig also
-
Good to know, thanks a bunch!
-
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(){...}
-
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!)
-
Information Architect
Yeah, thats nice. i allready started to code everything on the first frame. No more control mc's and ugly things like that.
Fredi
-
Retired Mod
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!
-
Whoa that is so useful, now I'm gonna start re-doing some of my old project with this...
-
Information Architect
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
-
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?
-
source code
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
-
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
-
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;
-
Information Architect
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
-
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
-
Information Architect
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.
-
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.
-
Information Architect
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
-
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|