• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Can anyone solve this issue?

New Here ,
Jun 07, 2011 Jun 07, 2011

Copy link to clipboard

Copied

Hi All,

I have an application, which loads FlashPaper  files. I am loading the flashpaper.swf into main.fla. The main.fla is  using Actionscript 3.0.

At the same time the flashpaper.fla is  scripted in Actionscript 2.0. Within flashpaper.fla, I am loading the  actual flashpaper content (FPDoc.swf) and using the following script to  load it.

function loadFlashPaper(SWFPath, FPWidth, FPHeight, FPZoom, FPY) {
    var FPHolder:MovieClip = this.createEmptyMovieClip(SWFPath.substr(0, SWFPath.indexOf('.')), this.getNextHighestDepth());
    FPHolder._y = FPY;
    var intervalID = 0;
    var loadFunc = function () {
        FPHolder._visible = false;
        FPHolder.onLoaded(FPHolder.getIFlashPaper(),FPZoom);
        if (!FPHolder.getIFlashPaper()) {
            return;
        } else if (FPHolder.getIFlashPaper().setSize(FPWidth, FPHeight) == false) {
            return;
        } else {
            clearInterval(intervalID);
            FPHolder._visible = true;
            FPHolder.traceUIElements();
        }
    };
    intervalID = setInterval(loadFunc, 1000);
    FPHolder.loadMovie(thisUrl+SWFPath);
}

loadFlashPaper("FPDoc.swf",600,400,100,0);

Later, I am using the following script to load the flashpaper.swf in to main.fla.

removeLoader();
var loaderObject:Loader =new Loader();
loaderObject.name="FPLoader";
var URLPath:URLRequest=new URLRequest("flashpaper.swf");

function completeHandler(event:Event):void {
    var printHolder:String=String(event.target.content);
    if (printHolder=="[object AVM1Movie]") {
        loaderClip.addChild(loaderObject);
    }
}
loaderObject.contentLoaderInfo.addEventListener(Event.COMPLETE,complet eHandler);
loaderObject.load(URLPath);

function removeLoader():void {
    if (loaderClip.getChildByName("FPLoader")) {
        loaderClip.removeChild(loaderClip.getChildByName("FPLoader"));
    }
}

I am having more than one main.swf and I am loading it into index.fla alternatively while the user clicks on some menu buttons.

Everything works fine, if we loads the same file. If we loads any one of another main.swf alternatively, the BLACK SCREEN is appears in front of the loaded flashpaper content.

Let me know why it’s happening.  Pleases can I have the solution for same.

Thanks,

K Muruganandhan

TOPICS
ActionScript

Views

1.5K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 07, 2011 Jun 07, 2011

Copy link to clipboard

Copied

If the loading of the other content involves other code, then you should be showing that other code if that is where the problem arises.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 07, 2011 Jun 07, 2011

Copy link to clipboard

Copied

Hi Ned Murphy,

Thank you very much for you response.

I didn't get exactly what you are trying to say.

Thanks,

Muruganandhan K

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 07, 2011 Jun 07, 2011

Copy link to clipboard

Copied

What code is used for...  "If we loads any one of another main.swf alternatively, the

BLACK SCREEN is appears in front of the loaded flashpaper content."

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 07, 2011 Jun 07, 2011

Copy link to clipboard

Copied

Hi,

The code which I is used to load multiple main.swf is slightly modified here, the logic of the script is show below,

private var _loaderSWF:loaderSWF;

private var fileCount:Number=1;


_loaderSWF=new loaderSWF(loaderSWFHolder);
_loaderSWF.unloadSWF(loaderSWFHolder);
_loaderSWF.loadSWF"main"+fileCount+".swf");

_loaderSWF.addEventListener("SWFLoaded",completeHandler,false,0,true);

private function completeHandler(event:Event):void {
      SWFContainer=SWFHolder.getChildAt(0) as MovieClip;
        _loaderSWF.removeEventListener("SWFLoaded",completeHandler);
}

//________________________________Script File_________________________//

package {

    import flash.utils.*;
    import flash.xml.*;
    import flash.media.*;
    import flash.text.*;
    import flash.display.*;
    import flash.events.*;
    import flash.errors.*;

    public class loaderSWF extends EventDispatcher {

        private var classRef:Object;
        private var pBarFrame:Number;
        private var percentData:Number=0;
        private var fileName:String;

        public var loaderObject:Loader;
        public var SWFHolder:MovieClip;
        public var LoaderHolder:MovieClip;

        public function loaderSWF(SWFContainer:MovieClip):void {
            SWFHolder=SWFContainer;
            loaderObject=new Loader();
        }

        public function loadSWF(SWFPath:String):void {
            fileName=SWFPath;
            unloadSWF(SWFHolder);
            addListeners(loaderObject.contentLoaderInfo);
            var URLPath:URLRequest=new URLRequest(fileName);
            loaderObject.load(URLPath);
        }

        private function addListeners(dispatchEvents:IEventDispatcher):void {
            dispatchEvents.addEventListener(Event.COMPLETE,completeHandler);
            dispatchEvents.addEventListener(ProgressEvent.PROGRESS,progressHandler);
            dispatchEvents.addEventListener(Event.UNLOAD,unloadHandler);
        }

        private function removeListeners(dispatchEvents:IEventDispatcher):void {
            dispatchEvents.removeEventListener(Event.COMPLETE,completeHandler);
            dispatchEvents.removeEventListener(ProgressEvent.PROGRESS,progressHandler);
            dispatchEvents.removeEventListener(Event.UNLOAD,unloadHandler);
        }

        private function unloadHandler(event:Event):void {
            dispatchEvent(new Event("unloadComplate"));
        }

        private function completeHandler(event:Event):void {
            LoaderHolder=event.target.content as MovieClip;
            SWFHolder.addChild(LoaderHolder);
            dispatchComplete();
            removeListeners(loaderObject.contentLoaderInfo);
        }

        private function dispatchComplete():void {
            var holderName:String=SWFHolder.name;
            switch (holderName) {
                case "loaderSWFHolder" :
                    dispatchEvent(new Event("SWFLoaded"));
                    break;
               
            }
        }

        private function progressHandler(event:ProgressEvent):void {
            percentData=Number(Math.round(event.bytesLoaded)/Math.round(event.bytesTotal)*100);
        }

        public function get ProgressData():Number {
            return percentData;
        }

        public function set ProgressData(PD:Number):void {
            percentData=PD;
        }

        public function unloadSWF(currHolder:MovieClip):void {
            //trace("**unloadSWF**",currHolder.name);
            loaderObject.unloadAndStop(true);
            if (currHolder.numChildren>0) {
                for (var i=0; i<currHolder.numChildren; i++) {
                    currHolder.removeChildAt(i);
                }
            }
        }
    }
}

Thanks,

Muruganandhan K

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 07, 2011 Jun 07, 2011

Copy link to clipboard

Copied

Hi Ned Murphy,

The same kind of problem happened to some of peoples. I found them while searching the solution on internet.
To get an ida about the issue, pls gothrough the following links.


I tried the solution suggested by them, even the problem not solved.

Thanks,

Muruganandhan K

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 07, 2011 Jun 07, 2011

Copy link to clipboard

Copied

What specifically is the problem?  Is it that the original piece stays in the background or that the black screen should not be a black screen?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 08, 2011 Jun 08, 2011

Copy link to clipboard

Copied

Black Screen.jpg

The above image shows the exact problem. The flashpaper content goes behind the black screen. Actually the black screen should not come and its never created by from my side. It created by flash player.

The text visible in the images is the flashpaper content.

Thanks,

Muruganandhan K

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 08, 2011 Jun 08, 2011

Copy link to clipboard

Copied

I thought you said the black screen comes when you are loading other main swf content after having viewed the Flashpaper section.  If that's the case, the black screen is most likely the other main swf that you are loading... and it appears to be failing to load its own content, so that may be where you need to focus your effort--making the black screen display what it is supposed to.  I don't see where you do anything to remove the Flashpaper content, so it will remain if you don't unload it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 08, 2011 Jun 08, 2011

Copy link to clipboard

Copied

Hi Ned Murphy,

I am really thankful for your interest in this topic.

As you said, the another main.swf is not different one, its also loads the flashpaper content.

I am having multipe flashpaper document files, for example FPDoc1.swf to FPDoc10.swf.

Then the FPDoc.swf files are loading into flashpaper1.swf to  flashpaper10.swf. 

The flashpaper1.swf to  flashpaper10.swf uses Actionscript 2.0 to load FPDoc files.

Then I am loading flashpaper1.swf to flashpaper10.swf into main1.swf to  main10.swf.

The main1.swf to main10.swf scripted in Actionscript 3.0.

Finaly I am loading main1.swf to main10.swf in index.swf.

I am calling the method "_loaderSWF.unloadSWF(loaderSWFHolder);" to remove the already loaded  content into"loaderSWFHolder" at every time before loading any one of main1 to main10.

Finally, I never uses Black graphics anywhere in the files. Even the Black screen Width*Height is automatically generated by flashplayer.

Here is the script reference, which is used in index.swf.

private var _loaderSWF:loaderSWF;

private var fileCount:Number=1;


_loaderSWF=new loaderSWF(loaderSWFHolder);
_loaderSWF.unloadSWF(loaderSWFHolder);
_loaderSWF.loadSWF"main"+fileCount+".swf");

_loaderSWF.addEventListener("SWFLoaded",completeHandler,false,0,true);

//_________________________Script File_________________________//

package {

    import flash.utils.*;
    import flash.xml.*;
    import flash.media.*;
    import flash.text.*;
    import flash.display.*;
    import flash.events.*;
    import flash.errors.*;

    public class loaderSWF extends EventDispatcher {

        private var classRef:Object;
        private var pBarFrame:Number;
        private var percentData:Number=0;
        private var fileName:String;

        public var loaderObject:Loader;
        public var SWFHolder:MovieClip;
        public var LoaderHolder:MovieClip;

        public function loaderSWF(SWFContainer:MovieClip):void {
            SWFHolder=SWFContainer;
            loaderObject=new Loader();
        }

        public function loadSWF(SWFPath:String):void {
            fileName=SWFPath;
            unloadSWF(SWFHolder);
            addListeners(loaderObject.contentLoaderInfo);
            var URLPath:URLRequest=new URLRequest(fileName);
            loaderObject.load(URLPath);
        }

        private function addListeners(dispatchEvents:IEventDispatcher):void {
            dispatchEvents.addEventListener(Event.COMPLETE,completeHandler);
            dispatchEvents.addEventListener(ProgressEvent.PROGRESS,progressHandle r);
            dispatchEvents.addEventListener(Event.UNLOAD,unloadHandler);
        }

        private function removeListeners(dispatchEvents:IEventDispatcher):void {
            dispatchEvents.removeEventListener(Event.COMPLETE,completeHandler);
            dispatchEvents.removeEventListener(ProgressEvent.PROGRESS,progressHan dler);
            dispatchEvents.removeEventListener(Event.UNLOAD,unloadHandler);
        }

        private function unloadHandler(event:Event):void {
            dispatchEvent(new Event("unloadComplate"));
        }

        private function completeHandler(event:Event):void {
            LoaderHolder=event.target.content as MovieClip;
            SWFHolder.addChild(LoaderHolder);
            dispatchComplete();
            removeListeners(loaderObject.contentLoaderInfo);
        }

        private function dispatchComplete():void {
            var holderName:String=SWFHolder.name;
            switch (holderName) {
                case "loaderSWFHolder" :
                    dispatchEvent(new Event("SWFLoaded"));
                    break;
               
            }
        }

        private function progressHandler(event:ProgressEvent):void {
            percentData=Number(Math.round(event.bytesLoaded)/Math.round(event.byt esTotal)*100);
        }

        public function get ProgressData():Number {
            return percentData;
        }

        public function set ProgressData(PD:Number):void {
            percentData=PD;
        }

        public function unloadSWF(currHolder:MovieClip):void {
            loaderObject.unloadAndStop(true);
            if (currHolder.numChildren>0) {
                for (var i=0; i<currHolder.numChildren; i++) {
                    currHolder.removeChildAt(i);
                }
            }
        }


    }
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 08, 2011 Jun 08, 2011

Copy link to clipboard

Copied

There is a confusion of loaders that you need to sort out.  If the loader in the background should have been unloaded but is not, then focus on getting that working first.  Then see about loading whatever other new content afterwards.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 08, 2011 Jun 08, 2011

Copy link to clipboard

Copied

Let me know where is the loding confusion and what to do?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 08, 2011 Jun 08, 2011

Copy link to clipboard

Copied

LATEST

Don't know if this is related to your specific problem, but this method of clearing children is ineffective:

if (currHolder.numChildren>0) {
    for (var i=0; i<currHolder.numChildren; i++) {
         currHolder.removeChildAt(i);
    }
}

Use this:

while(currHolder.numChildren>0)

{

     currHolder.removeChildAt(0);
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines