Is there a difference in the behavior of EventListner between placing it on a server and hitting html directly?

Asked 1 years ago, Updated 1 years ago, 139 views

Thank you for your hard work.My name is Jun, and I am a beginner of AS.

Is the behavior of EventListner different from that of hitting html directly?

This is because I tried to load and display the external swf passed by flashVars as shown below.

When I put the published swf and the external swf I was going to refer to on the server and hit it, it showed up properly, but when I double-click index.html locally, it doesn't even hit the onComplete method.

Why is that?

index.html

<embed src="swfPlayer.swf" width="300" height="500" FlashVars="file=test.swf">


swfPlayer/Main.as

private function_load():void
{
  :
varfv:Object=LoaderInfo(this.root.loaderInfo).parameters;
var file: String = String(fv["file"]);

var loader: Loader = new Loader;
varurl —URLRequest=newURLRequest(file);
loader.load(url);

loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
  :
}

private function onComplete (event:Event): void
{
    Log.t("complete");

    var loaderInfo: LoaderInfo=event.target as LoaderInfo;
    var content —MovieClip = loaderInfo.content as MovieClip;
    addChildAt(content,0);

    Log.t("complete-end";
}

flash actionscript

2022-09-30 19:43

1 Answers

If you're trying it on Google Chrome,
Why don't you run Google Chrome as follows?

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --allow-file-access-from-files

Google Chrome has limited access to local files by default, so
This is the option to remove it.

I often use shortcuts with this option to try locally.


2022-09-30 19:43

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.