URLRequest multiple SWF links are not working properly

I am trying to load 3 different keys in 3 different containers. When I delete this line:

loader2.load(new URLRequest("http://tickers.playtech.com/jackpots/new_jackpot.swf?casino=cityclub&info=1&game=bl&font_face=Arial&bold=true&font_color=FFFFFF&bg_color=240000&font_size=24&currency=eur")); loader3.load(new URLRequest("http://tickers.playtech.com/jackpots/new_jackpot.swf?casino=cityclub&info=1&game=bl&font_face=Arial&bold=true&font_color=FFFFFF&bg_color=240000&font_size=24&currency=eur")); 

and load them separately, they work fine:

enter image description here

but when I load them together, just as written in this document on adobe, all three tickers show the same number:

enter image description here

 package { import flash.display.MovieClip; import flash.net.URLRequest; import flash.display.Loader; public class importExternalSWF extends MovieClip { private var loader:Loader = new Loader(); private var loader2:Loader = new Loader(); private var loader3:Loader = new Loader(); public function importExternalSWF() { loader.load(new URLRequest("http://tickers.playtech.com/jackpots/new_jackpot.swf?casino=cityclub&info=1&game=mrj-4&font_face=Arial&bold=true&font_color=FFFFFF&bg_color=240000&font_size=24&currency=eur")); loader2.load(new URLRequest("http://tickers.playtech.com/jackpots/new_jackpot.swf?casino=cityclub&info=1&game=bl&font_face=Arial&bold=true&font_color=FFFFFF&bg_color=240000&font_size=24&currency=eur")); loader3.load(new URLRequest("http://tickers.playtech.com/jackpots/new_jackpot.swf?casino=cityclub&info=1&game=grel&font_face=Arial&bold=true&font_color=FFFFFF&bg_color=240000&font_size=24&currency=eur")); ticker1.addChild(loader); ticker1.width=50; ticker1.height=20; ticker2.addChild(loader2); ticker2.width=50; ticker2.height=20; ticker3.addChild(loader3); ticker3.width=50; ticker3.height=20; } } } 

I can not find a solution anywhere

thanks

change I'm rewriting my code on this and its still the same result

 public class importExternalSWF extends MovieClip { public function importExternalSWF() { var url = "http://tickers.playtech.com/jackpots/new_jackpot.swf"; var urlParams:Array = ["grel", "bl", "game=mrj-4"]; var tickers:Array = [ticker1, ticker2, ticker3]; var tickerHeight:Number = 50; var tickerWidth:Number = 50; loadUrls(); function loadUrls():void { for(var i:uint = 0; i<urlParams.length; i++) { var urlLoader = new Loader(); var flashvars:URLVariables = new URLVariables(); flashvars["casino"] = "cityclub"; flashvars["info"] = "1"; flashvars["game"] = urlParams[i]; flashvars["currency"] = "eur"; flashvars["font_face"] = "arial"; flashvars["bold"] = "true"; flashvars["font_size"] = "10"; flashvars["bg_color"] = "0x000000"; flashvars["font_color"] = "ffffff"; var request:URLRequest = new URLRequest(url); request.data = flashvars; urlLoader.load(request); tickers[i].width=tickerWidth; tickers[i].height=tickerHeight; tickers[i].addChild(urlLoader); } } } 
+4
source share
4 answers

There was no solution to this problem due to a lack of compatibility with a third ticker company.

0
source

I suspect that the external SWF file sets some variables at the root level. Therefore, each load will override the previous values, and you will get the same result in all β€œtickers”.

Most likely, this interference can be solved by loading each SWF into its own ApplicationDomain . By default, SWFs are loaded into the same ApplicationDomain and share their code.

So instead:

 urlLoader.load(request); 

You should do this:

 // create a new LoaderContext with a spearate ApplicationDomain var context:LoaderContext = new LoaderContext(false, new ApplicationDomain()); // load the request and use the context with the separate ApplicationDomain urlLoader.load(request, context); 
+3
source

I have bad news, I tried everything, but I can not load swf files correctly. So, I started researching this, and I found that, firstly, your SWF is in the AVM1Movie format (new_jackpot.swf), so I came to the conclusion that this SWF was created with version 1 or 2 of ActionScript. If you see the link of the AVM1Movie class (here is the link ), you can say the following:

There are several restrictions on the SWF AVM1 file downloaded by the SWF AVM2 file:

  • The SWF file AVM1 loaded by the SWF file AVM2 cannot load another SWF file into it. That is, it cannot load another SWF file on top of itself. However, Sprite child objects, MovieClip objects, or other SWF files AVM1 loaded by this SWF file can be loaded for this.

Then I also tried with a library that implements Threads in Flex, and found this (here is this async-threading link):

  • The ActionScript Virtual Machine (AVM) in Flash Player is very limited to only one thread ...

I created several projects using Loaders, SWFLoaders, ByteArrays, etc., all in ActionScript 3 in the Flex SDK 3.2. Perhaps if you create this project in a previous version, you can work or try to use the same library that implements streams.

Anyway, if I find something else, edit this answer with another correct solution.

+3
source

Try adding 1 after "laoder" in these places:

 private var loader:Loader = new Loader(); 


 loader.load(new URLRequest("http://tickers.playtech.com/jackpots/new_jackpot.swf?casino=cityclub&info=1&game=mrj-4&font_face=Arial&bold=true&font_color=FFFFFF&bg_color=240000&font_size=24&currency=eur")); 
+2
source

Source: https://habr.com/ru/post/1492696/


All Articles