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

Shared object does not display to another swf on AIR

Explorer ,
Sep 08, 2017 Sep 08, 2017

I have created an test app for test shared objects.I have three fla,two game and one main fla for call other swf files(external).

Main FLA

import tsiko;

var mypipi:Loader = new Loader();   // create a new instance of the Loader class
var myurl:URLRequest = new URLRequest("game2.swf"); // This is game 2

var mypipi2:Loader = new Loader();  
var myurl2:URLRequest = new URLRequest("game1.swf"); //This is game 1 in this case both SWFs are in the same folder



wh3gna
.addEventListener(MouseEvent.CLICK, dinsvslov);

function dinsvslov(event:MouseEvent😞void
{


  mypipi
.load(myurl);   // load the Game 2
addChild
(mypipi);


}





stage
.addEventListener(Event.ENTER_FRAME,bibisa);
function bibisa(oly:Event) {


  
//if game 2 done than call the game 1 and remove game 2


  
if(tsiko.sansangelme==true){

  mypipi2
.load(myurl2);   // load the SWF file
addChild
(mypipi2);



  mypipi
.unloadAndStop();

  tsiko
.sansangelme=false;


}


}

Game 2 save the number.

import tsiko; 
import flash.net.SharedObject;
import flash.events.NetStatusEvent; 

var
mynumber:Number=555;
var bsa4:SharedObject = SharedObject.getLocal("goster");
bsa4
.data.tok = mynumber;    bsa4.flush(); 
var flashstatus:String=bsa4.flush();

if(flashstatus !=null){ switch(flashstatus)
{
case SharedObjectFlushStatus.PENDING: trace("waiting")
break;
case SharedObjectFlushStatus.FLUSHED: trace("great saved")
break;
}
} 

tsiko
.sansangelme=true; // Goto main menu    stop();










And game 1 for show the shared number but it's not working.

import tsiko;

import Turn;

import flash.net.SharedObject;

import flash.events.NetStatusEvent;

var bsa1:SharedObject = SharedObject.getLocal("goster");

var myno:Number=0;

myno=bsa1.data.csok;

tipo.text = String(myno);

stop();

Game 2 flushed the number perfect but I can't see on the game 1 swf.

I get NaN message.How should I do for display the data on game 2.



TOPICS
ActionScript
427
Translate
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

correct answers 1 Correct answer

Community Expert , Sep 08, 2017 Sep 08, 2017

each fla has a different sharedobject.

you can create one sharedobject in you main fla and access it from each loaded game fla.

Translate
Community Expert ,
Sep 08, 2017 Sep 08, 2017
LATEST

each fla has a different sharedobject.

you can create one sharedobject in you main fla and access it from each loaded game fla.

Translate
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