mattsven
mattsven

Reputation: 23263

Issues loading Flex SWF into Flash

I'm trying to load a Flex SWF into my Flash SWF, but it's not working. I'm getting this error:

Error: Error #2136: The SWF file file:///C|/Program%20Files/Adobe/Adobe%20Fireworks%20CS6/Configuration/Command%20Panels/Texture Panel.swf contains invalid data.

    at _Main_mx_managers_SystemManager/create()
    at mx.managers.systemClasses::ChildManager/initializeTopLevelWindow()
    at mx.managers::SystemManager/initializeTopLevelWindow()
    at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::kickOff()
    at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::preloader_completeHandler()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.preloaders::Preloader/timerHandler()
    at flash.utils::Timer/_timerDispatch()
    at flash.utils::Timer/tick()

And this is my Flash SWF's code:

package 
{
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.text.*;
    import adobe.utils.*;
    import flash.external.ExternalInterface;
    import flash.display.Loader;
    import flash.net.URLRequest;

    public class Main extends Sprite 
    {

        public function Main():void 
        {
            if (stage) init(); else addEventListener(Event.ADDED_TO_STAGE, init);
        }

        private function init(e:Event = null):void 
        {
            removeEventListener(Event.ADDED_TO_STAGE, init);

            var myLoader:Loader = new Loader(); addChild(myLoader);

            function systemManagerHandler(event:Event):Boolean { event.preventDefault(); return false; }

            myLoader.addEventListener("mx.managers.SystemManager.isBootstrapRoot", systemManagerHandler);
            myLoader.addEventListener("mx.managers.SystemManager.isStageRoot", systemManagerHandler);

            myLoader.load(new URLRequest("Texture Panel.swf"));
        }

    }

}

I'd love ANY help with this. Thanks in advance!

Upvotes: 1

Views: 748

Answers (1)

csomakk
csomakk

Reputation: 5497

Tip from andy moore:

1) Flash: File > New > Flash AS3.0 File

2) Copy the entire “library” from your old FLA

3) Paste the entire “library” to the new FLA

4) DELETE THE OLD FILE, IT IS MAGICAL POISON

Upvotes: 1

Related Questions