views:

1714

answers:

4

I've gone over the Alchemy quick start guide and exported my stringecho.swc successfully, but I don't want to compile in Flex. I just don't know Flex and I'm not very keen on learning it all of a sudden. I tried to do my business in Flash, instead, considering that they both run on AS3. The Flex code they give as an example is

package
{
    import flash.display.Sprite;
    import cmodule.stringecho.CLibInit;

    public class EchoTest extends Sprite
    {
     public function EchoTest()
     {
      var loader:CLibInit = new CLibInit;
      var lib:Object = loader.init();
      trace(lib.echo("foo"));
     }
    }
}

I've added my swc in the Flash CS4 options and thought I could convert the Flex code into the following AS3 Flash code, written in the timeline:

import cmodule.stringecho.CLibInit;

var loader:CLibInit = new CLibInit;
var lib:Object = loader.init();
trace(lib.echo("foo"));

But, alas, I get the following error at runtime: ReferenceError: Error #1065: Variable MainTimeline is not defined.

I've not enough experience with Flex, but quite a lot with Flash, but that error tells me nothing at all. I haven't heard of any properties of the stage object or whatever called MainTimeline. Could someone tell me why I get the error or why what I'm doing is just plain stupid?

+1  A: 

Never mind, I made it work. Under Profile->Edit->SWF Settings, I checked "Export SWC". Not sure why it works, maybe someone could still give me a logical explanation...

evilpenguin
A: 

I have the same problem using a SWC I get #1065 Error code about the MainTimeline and also about Sprites in the Library which I Export for AS :/

martinlindelof
A: 

Thanks for posting your solution. It's an unexpected but perfect fix.

A: 

OMG, I was beginning to get so frustrated until I tried your fix. THANK YOU!!

baduncaduncan