| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Registered User
Join Date: Jan 2007
Posts: 85
|
Hello there,
I just started coding ActionScript 3 with Flash CS3, I'm trying to add a event to the stage from the document class, but it never occurs (dispatch)? PHP Code:
thanks for any help. regards, Hw2002 |
|
|
|
|
|
#2 |
|
Flash Adventurer
Join Date: Mar 2005
Location: Silicon Valley
Posts: 1,975
|
Have you tried this?
ActionScript Code:
I've found that specifically referencing the stage can have different results somtimes. |
|
|
|
|
|
|
|
|
#3 | |
|
Registered User
Join Date: Jan 2007
Posts: 85
|
Quote:
But what do you mean by "It can have different results sometimes?", since I developing something to a customer, and I want it to work always as I excepted it to work? I hope you can tell me what you mean and thanks again for your help ![]() |
|
|
|
|
|
|
#4 |
|
Flash Adventurer
Join Date: Mar 2005
Location: Silicon Valley
Posts: 1,975
|
The line of code I suggested will always work the way you expect. You misunderstood my meaning. What I ultimately meant is that your document class is not the stage. The reason your code wasn't working before is because the document class didn't contain anything that was clickable. To make it clickable, you need to draw something on it. I suggested using the stage because you can always listen for mouse events from the stage object regardless of what's been drawn.
|
|
|
|
|
|
#5 |
|
Registered User
Join Date: Jan 2007
Posts: 85
|
I actually thought the document class was the root for my whole stage, but as I understand from you, its not
and I have to put events on the stage and not on my document class.this made me thing about the _root, I used to do something like this with AS2: _root.onEnterFrame = function():void { } and not stage.onEnterFrame? Do you have the time to explain and many thanks to you |
|
|
|
|
|
#6 |
|
six eyes
|
see "How stage, root, and MainTimeline Fit Together":
http://www.kirupa.com/forum/showthre...48#post2129548
__________________
(6) |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Why can't I access a Class object variable with a for..in loop from my main movie?? | kosfsh | ActionScript 2.0 | 0 | 05-14-2007 04:56 PM |
| Extendings class... | simonboris | ActionScript 2.0 | 0 | 02-25-2006 05:53 PM |
| How to access a symbol instance from a class ? | seby | ActionScript 2.0 | 7 | 04-01-2005 11:26 AM |
| Embedded Class Function Can't Access Variables | gus_welter | ActionScript 2.0 | 2 | 03-17-2005 08:50 PM |
| Inherited Properties problem with class hierarchy | Johnathon_apple | ActionScript 1.0 (and below) | 5 | 09-17-2003 01:38 AM |