ThemeForest

false, 0, true); Hm?

153 posts
  • Has been a member for 2-3 years
  • Exclusive Author
  • Bought between 1 and 9 items
  • Europe
AphroditeDesign says

I learn AS3 .0 for 2 days and I have 1 little problem.

stopBtn.addEventListener(MouseEvent.CLICK, onStopClick, false, 0, true);

I don’t understand why we need false, 0, true at end? What that do? Thanks and sorry for stupidity.

3 years ago
3675 posts
  • Has been a member for 3-4 years
  • Exclusive Author
  • Sold between 5 000 and 10 000 dollars
  • Brazil
  • Referred between 1 and 9 users
tsafi says

Its call weakly referenced if you don’t remove your listener, there is no garbage sweeping so if the listener is true (last parameter) makes this as weekly referenced. and allow garbage sweeping from memory .

Still if you remove your listener you don’t have to use the 5 parameters method.

welcome to the AS3 club .

3 years ago
3335 posts
  • Has been a member for 2-3 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Author had a Free File of the Month
  • Beta Tester
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Bought between 10 and 49 items
  • Italy
doru says

this is an advanced topic and you should leave it for when you have a better idea about all this as3 stuff

you can write only

stopBtn.addEventListener(MouseEvent.CLICK, onStopClick);

and it will work with out a problem.

3 years ago
3675 posts
  • Has been a member for 3-4 years
  • Exclusive Author
  • Sold between 5 000 and 10 000 dollars
  • Brazil
  • Referred between 1 and 9 users
tsafi says
this is an advanced topic and you should leave it for when you have a better idea about all this as3 stuff

you can write only

stopBtn.addEventListener(MouseEvent.CLICK, onStopClick);

and it will work with out a problem.
advanced topic? you meant basic topic i think ….....
3 years ago
3335 posts
  • Has been a member for 2-3 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Author had a Free File of the Month
  • Beta Tester
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Bought between 10 and 49 items
  • Italy
doru says
advanced topic? you meant basic topic i think ….....

I mean advanced topic for people who have 2 days of actionscript. :|

There are 3 parameters after that function name, can you explain what they do? but always on a very beginner level. Like the “useCapture” option? Or the “priority”?

3 years ago
1235 posts
  • Has been a member for 4-5 years
  • Exclusive Author
  • Sold between 50 000 and 100 000 dollars
  • Elite Author
  • Bought between 50 and 99 items
  • United Kingdom
  • Referred between 200 and 499 users
LGLab says
I learn AS3 .0 for 2 days and I have 1 little problem. stopBtn.addEventListener(MouseEvent.CLICK, onStopClick, false, 0, true); I don’t understand why we need false, 0, true at end? What that do? Thanks and sorry for stupidity.

I’m learning AS3 as well, and you definitely should get in the habit to set your listeners to weak, you can read more about it here:

http://www.gskinner.com/blog/archives/2006/07/as3_weakly_refe.html

Basically, in AS3 , if you don’t remove your listeners manually, even if you do remove the object the listener is listening to from the display list, the object will not be garbage collected, and will still be using memory So the best practice is to make sure you always remove your listeners when you don’t need them anymore.

However, setting your listeners to “weak” can be seen as a backup plan basically, so that if you do forget to remove your listerner, the object will still be garbage collected when it is no longer referenced to.

Note i am also a AS3 newbie, but this is what I understood so far ;-)

3 years ago
153 posts
  • Has been a member for 2-3 years
  • Exclusive Author
  • Bought between 1 and 9 items
  • Europe
AphroditeDesign says

Thank you guys…

BTW , I learn by reading a Learning ActionScript3.0 A Beginners Guide and Im on chapter 6 now (OOP). My problem is that I dont know more than basics of variables, functions, display list etc. so I cant build something with that knowledge. Is that my problem, am I wrong or its will be better and better with practice? It seems very complicated to me but I dont want give up.

3 years ago
3335 posts
  • Has been a member for 2-3 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Author had a Free File of the Month
  • Beta Tester
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Bought between 10 and 49 items
  • Italy
doru says

everything its difficult at the beginning, you can’t know all in just a couple of days. Programming its a vast territory. Just don’t give up :)

the false option after the name of the function, more info here

http://www.adobe.com/devnet/actionscript/articles/event_handling_as3_03.html

3 years ago
1235 posts
  • Has been a member for 4-5 years
  • Exclusive Author
  • Sold between 50 000 and 100 000 dollars
  • Elite Author
  • Bought between 50 and 99 items
  • United Kingdom
  • Referred between 200 and 499 users
LGLab says
Thank you guys… BTW , I learn by reading a Learning ActionScript3.0 A Beginners Guide and Im on chapter 6 now (OOP). My problem is that I dont know more than basics of variables, functions, display list etc. so I cant build something with that knowledge. Is that my problem, am I wrong or its will be better and better with practice? It seems very complicated to me but I dont want give up.

I am also reading this book, and removing of event listeners is discussed at the beginning, on page 46 – Weakly referenced listeners is also discussed on page 47, I would advise you not to skip any part of the book if you are just starting.

AS3 is definitely not easy, but it’s not impossible, so don’t give up, you will certainly pull your hair out until the last while trying to figure stuff out, but there is a light at the end of the tunnel ;-)

3 years ago
153 posts
  • Has been a member for 2-3 years
  • Exclusive Author
  • Bought between 1 and 9 items
  • Europe
AphroditeDesign says

Something missing in my brain to understand that… I will read book again from start when I will be concentrated on content with more clarity. My problem is that I want read it fast but nothing can be faster than normal way.

3 years ago
by
by
by
by
by