This has got me stumped.
The Requirement: To cause the Main Timeline to play(), gotoAndStop(), etc, on command from an AS3 class instance (defined in an external package).
The Situation: Two strategies have worked fine in the IDE (standalone player), but fail when uploaded to a server and run through a browser (IE7).
Strategy 1:
Pass the timeline reference to the constructor (from the main timeline) thus:
myInstance = new myClass(this);
In the constructor use the reference (tl) to call a main timeline function tl.myFunction(param) that calls gotoAndPlay(), etc.
[COLOR=darkred]Result 1:[/COLOR] Works in IDE, fails on-line. :tired:
Strategy 2:
- Define a CONST for user-defined events.
- Dispatch the events from various places within class (instance) code thus:
*var result:Boolean = this.dispatchEvent(new Event(MY_EVENT)); *[SIZE=1](‘result’ gets true)[/SIZE]
Define listeners on the timeline like so:
myInstance.addEventListener(MY_EVENT,myFunction);
**[COLOR=darkred]Result 2: [/COLOR]**Works in IDE, fails on-line :{
What’s going on that either approach works in the IDE, but not in the browser?
[COLOR=darkgreen]Grateful for any clues.[/COLOR]