Skip to main content
emmau10371638
Inspiring
August 10, 2016
Answered

Home_btn to reload iOS app is not working???

  • August 10, 2016
  • 1 reply
  • 3076 views

hello again,

I can't find the solution.

I hope someone can help me because I'm desparate.

I  have a main-SFW within several levels-SWF's.

Now I want on each level a Home_btn so I can reload the app.

Here is my code in some SWF-level:

Home_btn.addEventListener(MouseEvent.CLICK, go_home);

function go_home(event: MouseEvent) {

  var appDomain_1:ApplicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain);

var context1:LoaderContext = new LoaderContext(false, appDomain_1);

var loader1:Loader = new Loader();

var file1: File = File.applicationDirectory.resolvePath("main.swf");

loader1.load(new URLRequest (file1.url), context1);

  addChild(loader1);

}

in the main.SWF the level_SWF's won"t open again.

I have included all SWF's in the MainSWF and the main SWF also.

I hope someone can help me.

This topic has been closed for replies.
Correct answer kglad

hello,

the movieclip go_1 doesn't work on the ipad.

when you touch  the movie clip nothing happens

.(the mouse(down)_function )on the computer it works very good.

a mouse function separately (not in a for loop )is not a problem on the ipad.

tnx for reply.


attach a screenshot of your air for ios settings panel that shows your included files.

1 reply

kglad
Community Expert
Community Expert
August 10, 2016

each level swf can direct the main swf to unload the level swf, but because your main swf is not loaded, i don't think you want to load it into itself.

emmau10371638
Inspiring
August 10, 2016

hello,

tnx for reply..

the structure of my app is:  before I open a new level the previous level has been unloaded.

But now I want back to start the whole app again with new levels SWF's.

First I think I must close the app.But I don't know how to do this. Because the NativeApplication.

NativeApplication.exit (); didn't work. Sorry i didn't understand it at all. I hope you can help me.

kglad
Community Expert
Community Expert
August 12, 2016

Tnx a lot kglad,

I have studied your code and i have also changed my own code into your code.

It is much better.

i only have changed the code:this['go_'+n)].visible = true; into: this['go_'+n].visible = true;

i hope it's good.

But i have also the next error:

ArgumentError: Error #1063: Argument count mismatch on flash.events::EventDispatcher/hasEventListener(). Expected 1, got 2.

  at main_fla::MainTimeline/goF()[main_fla.MainTimeline::frame1:33]

  at main_fla::MainTimeline/frame1()[main_fla.MainTimeline::frame1:28]

[UnloadSWF] main.swf

Testfilm beëindigd.

frame1:33 =      if(!this['go_'+(i+1)].hasEventListener(MouseEvent.CLICK,load_levelF)){

frame1:28 =goF(current_level);

I hope you can help me again.


if(!this['go_'+(i+1)].hasEventListener(MouseEvent.CLICK,load_levelF)){

should be

if(!this['go_'+(i+1)].hasEventListener(MouseEvent.CLICK)){