# Controlling Main Timeline from external AS

**URL:** <https://forum.kirupa.com/t/controlling-main-timeline-from-external-as/276173>\
**Category:** flash\
**Created:** [November 24, 2008, 7:13am UTC](https://forum.kirupa.com/t/controlling-main-timeline-from-external-as/276173 "2008-11-24T07:13:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![avionwbt](https://avatars.discourse-cdn.com/v4/letter/a/c37758/32.png) [@avionwbt](https://forum.kirupa.com/u/avionwbt)\
**Post date:** [November 24, 2008, 7:13am UTC](https://forum.kirupa.com/t/controlling-main-timeline-from-external-as/276173/1 "2008-11-24T07:13:05Z")

</div>

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:**

1. Define a CONST for user-defined events.
2. 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]
