A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Multiple swfs not playing in IE8

  1. #1
    Mourning Morning. groupof1's Avatar
    Join Date
    Feb 2008
    Location
    Middle of somewhere
    Posts
    194

    Multiple swfs not playing in IE8

    I am having an issue and I can't pinpoint it.
    What I have is a SWF that loads multiple smaller SWFs into an array and then uses buttons to switch between them in a movie clip container on the stage.

    Everything works when I pub my main SWF and even when I run it in a browser from my desktop.

    When I upload to the server and try to run it online, I run into this problem.
    All the SWFs load, but only the last one to load actually plays in the container.
    The others seem to be stuck in frame 1.

    The clips have no code in them, they are simple animations. And if I change the load order, still only the last clip plays. So I know it isn't the SWFs causing the problem. I am locked into using IE 8 and the flashplayer is version 10.3.

    Anyone know of any issues with IE 8 or a reason that only the last file loaded would play?

    here is my code, but as I said it seems to work fine until I run it online.
    Code:
    import flash.net.URLRequest;
    import flash.display.MovieClip;
    import flash.events.Event;
    
    var swfLoader:Loader;
    var swfRequest:URLRequest;
    
    
    var swfPathArr:Array = new Array("clip0.swf", "clip1.swf", "clip2.swf", "clip3.swf");
    var loadedSWFs:int;
    
    var swfClipsArr:Array = new Array();
    var swfTempClip:MovieClip; 
    
    startLoading(swfPathArr);
    
    function startLoading(pathArr:Array):void {
    	swfLoader = new Loader();
    	swfRequest = new URLRequest();
    	loadSWF(pathArr[0]);
    }
    
    function loadSWF(path:String):void {
        setupListeners(swfLoader.contentLoaderInfo);
       
        swfRequest.url = path;
        swfLoader.load(swfRequest);
    }
    
    function setupListeners(dispatcher:IEventDispatcher):void {
        dispatcher.addEventListener(Event.COMPLETE, onSwfComplete);
        dispatcher.addEventListener(ProgressEvent.PROGRESS, currentSwfProgress);
    }
    
    function currentSwfProgress(event:ProgressEvent):void {
        var _perc:int = (event.bytesLoaded / event.bytesTotal) * 100;
        // swfPreloader.percentTF.text = _perc + "%";
    }
    
    function onSwfComplete(event:Event):void {
    	event.target.removeEventListener(Event.COMPLETE, onSwfComplete);
        event.target.removeEventListener(ProgressEvent.PROGRESS, currentSwfProgress);
         
        swfTempClip = event.target.content;
        swfTempClip.customID = loadedSWFs;
         
        swfClipsArr.push(swfTempClip);
           
        if(loadedSWFs < swfPathArr.length - 1) {
    		loadedSWFs++;
            loadSWF(swfPathArr[loadedSWFs]);
        } else {
    		onCompletePreloading();
        }
    }
    
    function onCompletePreloading():void {
    	contentContainer.addChild(swfClipsArr[1]);
           
        button1.addEventListener(MouseEvent.CLICK, setContent);
        button2.addEventListener(MouseEvent.CLICK, setContent);
        button3.addEventListener(MouseEvent.CLICK, setContent);
    }
         
    function setContent(event:MouseEvent):void {
        var swfToAdd:MovieClip;
           
        switch(event.target.name) {
    		case "button1":
            swfToAdd = swfClipsArr[1];
            break;
               
            case "button2":
            swfToAdd = swfClipsArr[2];
            break;
               
            case "button3":
            swfToAdd = swfClipsArr[3];
            break;
        }
           
        contentContainer.removeChildAt(contentContainer.numChildren-1);
        contentContainer.addChild(swfToAdd);
    	swfToAdd.gotoAndPlay(1);
    
        trace(swfToAdd.customID);
    }
    What the world needs now is a nice hot bath.
    _________________________________________________
    Battles: Silverx2

  2. #2
    not too sure, but a lot of servers are case sensitive with file names, so make sure that is correct when you are trying to load swfs

  3. #3
    Mourning Morning. groupof1's Avatar
    Join Date
    Feb 2008
    Location
    Middle of somewhere
    Posts
    194
    Quote Originally Posted by cultcreative View Post
    not too sure, but a lot of servers are case sensitive with file names, so make sure that is correct when you are trying to load swfs
    The file names are all correct and the same case. As I mentioned, when I change the order in which they are loaded only the last one plays regardless of which file it is. It's bizarre.
    What the world needs now is a nice hot bath.
    _________________________________________________
    Battles: Silverx2

  4. #4
    hmm that is odd then..

    are you removing previous clips before adding the new one?
    are they different flash versions?

  5. #5
    Mourning Morning. groupof1's Avatar
    Join Date
    Feb 2008
    Location
    Middle of somewhere
    Posts
    194
    Quote Originally Posted by cultcreative View Post
    hmm that is odd then..

    are you removing previous clips before adding the new one?
    are they different flash versions?
    No, they are all built in CS5.
    I am removing the current child before adding the next child.

    My guess is that it either has something to do with the setContent function, or it is something in IE8 that is jacking with it.

    Code:
    function setContent(event:MouseEvent):void {
        var swfToAdd:MovieClip;
           
        switch(event.target.name) {
    		case "button1":
            swfToAdd = swfClipsArr[1];
            break;
               
            case "button2":
            swfToAdd = swfClipsArr[2];
            break;
               
            case "button3":
            swfToAdd = swfClipsArr[3];
            break;
        }
           
        contentContainer.removeChildAt(contentContainer.numChildren-1);
        contentContainer.addChild(swfToAdd);
    	swfToAdd.gotoAndPlay(1);
    
        trace(swfToAdd.customID);
    }
    Last edited by groupof1; 07-27-2011 at 03:30 PM. Reason: adding code
    What the world needs now is a nice hot bath.
    _________________________________________________
    Battles: Silverx2

  6. #6
    Mourning Morning. groupof1's Avatar
    Join Date
    Feb 2008
    Location
    Middle of somewhere
    Posts
    194
    Just realized that this is not working in Firefox either.

    It works in IE9 and in the flashplayer. Anyone have any ideas about how to get around this or to achieve the same effect?
    What the world needs now is a nice hot bath.
    _________________________________________________
    Battles: Silverx2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center