The documentation for Flash 9 and AS3 is currently not very helpful, so I have written 7 tutorials.
Here are the 2 help documents for F9 AS3 on adobe's site(they get lost, jumbled, mixed with flex docs, so I thought I post them here as solid links): F9 Language Reference F9 Programming Overview
You should definately add a tutorial about resource management/garbage collection, which is a lot more involved than it used to be because you can't remove a movieclip from memory anymore like you used to. A very useful link about this subject : http://www.gskinner.com/blog/archive...urce_ma_1.html
Before I read them, I found AS3 very hard to understand, and I was planning on using AS2 instead when F9 came, but your tutorial makes it pretty easy to understand
Make more please
I don't have a photograph, but you can have my footprints. They're upstairs in my socks.
I checked the link out Fall_X, however I am pretty sure there is no way to know when an object has be deleted. Objects with event listeners attached will not be deleted by the GC. I could be wrong, but tests I have done have shown that they wont get deleted.
I've just added a small article about the GC about removing your references.
I'm glad you like them, I will definitely make more. I plan to get a couple more up by Saturday.
Events are things like mouse clicks, key presses, etc. You can tell flash to listen for when an event occurs. When an event such as a mouse click is triggered, your "event handler" or your function will be called.
You can use addEventListener to tell flash what function or event handler to call when the event is triggered:
Here we are telling flash to listen to the Mouse click event on mybutton.
When mybutton is clicked it will call our event handler function MouseClickHandler:
Code:
function MouseClickHandler(event:MouseEvent):void {
trace("button is clicked");
}
Events are not limited to mouse clicks and keyboard presses. You can listen for an EnterFrame event, which is triggered every frame, or you could listen for a timer event, so you could call a function every second.
swak:
I was just about to make one . I'll post it later today.
I checked the link out Fall_X, however I am pretty sure there is no way to know when an object has be deleted. Objects with event listeners attached will not be deleted by the GC. I could be wrong, but tests I have done have shown that they wont get deleted.
I've just added a small article about the GC about removing your references.
I'm glad you like them, I will definitely make more. I plan to get a couple more up by Saturday.
Yeah, that's right, I know, but it's something people should be aware of - if you want to remove a movieclip (or sprite), you need to check that you :
- remove it from it's parent (removeChild)
- remove all event listeners
- stop all sounds it has playing, and delete the references to them
- either unparent all it's children or delete/null all references to it's children (and remove events on the children as well), or both - keeping references to it's children while they are still parented to it, means you still have a reference in the parent property of the children, which means no GC
- delete/null all references to it
That should do the trick in most cases. It's a bit tedious, but important.
If I'm not mistaking, unparenting all it's children will make the GC delete it a bit faster, ie on the normal pass. If, on the other hand, you decide to keep the children parented but delete all references to it's children, there's a circular reference thing going on, and it will only get deleted on the next mark and sweep pass - but I'm not sure about this.
I have a question about Flash 9. I have stopped scripting after Flash 7. So I guess I have missed a lot. I have seen the AS 3 reference and I have to say that it looks like JAVA to me. So my question is what is all the fuss about this Flex environment. Do I need it to use AS 3 or is it just like eclipse (i know it is based on eclipse) an editor that make things a lot easier?
No you no longer need to use flex to use AS3. You can now download the Flash 9 alpha, which has AS3.
I haven't used Flex, so I can't tell you much about it, but it does not make it easier. Flex serves a different purpose than Flash and does not replace it.