Search Results

Search found 12 results on 1 pages for 'applicationdomain'.

Page 1/1 | 1 

  • Flex SWF assets loaded into Flash SWF at runtime within same ApplicationDomain

    - by Xyre
    I'm trying to load a swf compiled by the Flex SDK into a swf exported by the Flash IDE and instantiate the assets by way of getDefinition(). Normally this works fine with assets exported from the Flash IDE then loaded into another swf also from Flash IDE. This is how I could normally do this using only the Flash IDE: Loader - Using same ApplicationDomain - getDefinition(class) Now, using the 'Test.as' compiled from Flex SDK using the [Embed] metadata tag: Loader - Using same ApplicationDomain - getDefinition("Test_" + class) The problem is I'd rather not have to keep track of the asset libraries loaded to prefix the class name I'd like to get (('Test_" + class) vs (class)). Is there any way of doing this without referencing the library the class is being pulled from or without accessing the original loader? This way I don't need to know which swf the asset is coming from, just the class name that I could instantiate from the current ApplicaitonDomain. Thanks

    Read the article

  • LoaderContext and ApplicationDomain changes with Adobe AIR ?

    - by Tyn
    Hello, I'm currently experimenting with loading external SWF files from both an standard AS3 application, and an AIR application. It seems that the AIR application doesn't act the same way a standard SWF run by the Flash Player does. According to the documentation, the applicationDomain property of LoaderContext is usable in an AIR application too, but it just seems to be not working. I have the following code : package { import flash.display.Loader; import flash.display.LoaderInfo; import flash.display.Sprite; import flash.events.Event; import flash.net.URLRequest; import flash.system.ApplicationDomain; import flash.system.LoaderContext; public class Invoker extends Sprite { private var _ldr : Loader; public function Invoker() { _ldr = new Loader(); _ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, onChildOneComplete); var ldrC : LoaderContext = new LoaderContext(false, new ApplicationDomain(ApplicationDomain.currentDomain) ); _ldr.load(new URLRequest("otherSwf.swf"), ldrC); } private function onChildOneComplete(e : Event) : void { var c1ad : ApplicationDomain = (e.target as LoaderInfo).applicationDomain; var inad : ApplicationDomain = ApplicationDomain.currentDomain; trace("Child One parentDomain : " + c1ad.parentDomain); trace("Invoker parentDomain : " + inad.parentDomain); trace("Child One has Invoker : " + c1ad.hasDefinition("Invoker")); trace("Invoker has Invoker : " + inad.hasDefinition("Invoker")); } } } Compiling this code as an SWF file and launching it with the Flash Player does this output, which seems right : Child One parentDomain : [object ApplicationDomain] Invoker parentDomain : null Child One has Invoker : true Invoker has Invoker : true But the same code as an AIR application does a different output : Child One parentDomain : null Invoker parentDomain : null Child One has Invoker : false Invoker has Invoker : true According to the documentation, the first output (using a SWF with Flash Player, and not an AIR application) is the right one. Also, playing around with this snippet and changing the application domain to others possible configurations (like new ApplicationDomain(null), or ApplicationDomain.currentDomain) does exaclty what the documentation says with the SWF, but does not change the output of the AIR application. Any clue why AIR is simply ignoring the application domain passed to the loader context ? Any documentation about this particular issue ? Thank you very much.

    Read the article

  • Flash - can't access classes in another SWF

    - by Ashley Muller
    Hi, I'm trying to load a local SWF file and use the classes in that SWF (its a code only SWF, nothing in library). Here's the code that loads the library: var AD:ApplicationDomain = ApplicationDomain.currentDomain; var context:LoaderContext = new LoaderContext(false, AD); SA_gamecore_loader = new Loader(); SA_gamecore_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onGameCoreLibraryDataComplete); SA_gamecore_loader.load(new URLRequest("GameCore.swf"), context); Here's the code that tries to instantiate a class from GameCore.swf: var test:Class = GetClassFromDefinition("MenuArt") as Class; var testInstance:Object = new test(); public function GetClassFromDefinition(theStr:String):Object { var theClass:Object; try { theClass = GameCoreLibraryData.applicationDomain.getDefinition(theStr); } catch(e:ReferenceError) { trace(e); return null; } return theClass; } And this is the message that's traced: ReferenceError: Error #1065: Variable MenuArt is not defined. The GameCore.swf is in the same location as the parent swf. I'm using Flash Develop if that helps. Anyone able to point out what I'm doing wrong?

    Read the article

  • Running Assemblies in custom application domains

    This sounds like a deep technical thing and internally it's right too. But in a developer prospective, if he needs to run an assembly under a fresh new ApplicationDomain, it's so easy like just use some of the classes defined in System NameSpace. Below I am explaining this with a small console application.

    Read the article

  • Policy file error while loading images form facebook

    - by Fahim Akhter
    Hi, I making a game leaderboard on facebook. I'm not using connect but working inside the canvas. When I try to load the images from facebook it gives me the following error. SecurityError: Error #2122: Security sandbox violation: Loader.content: http://test cannot access http://profile.ak.fbcdn.net/v22941/254/15/q652310588_2173.jpg A policy file is required, but the checkPolicyFile flag was not set when this media was loaded. Here is my loader code public var preLoader:Loader; preLoader=new Loader(); **update** Security.loadPolicyFile('http://api.facebook.com/crossdomain.xml'); Security.allowDomain('http://profile.ak.fbcdn.net'); Security.allowInsecureDomain('http://profile.ak.fbcdn.net'); **update-end** public function imageContainer(Imagewidth:Number,Imageheight:Number,url:String,path:String) { preLoader=new Loader(); Security.loadPolicyFile("http://api.facebook.com/crossdomain.xml"); var context:LoaderContext = new LoaderContext(); context.checkPolicyFile = true; context.applicationDomain = ApplicationDomain.currentDomain; preLoader.load(new URLRequest(path),context); Any Ideas? I am importing the right class though. UPDATE: I am loading the images from a different domain say , calling func http://fahim.com images are from http://profile.ak.fbcdn.net/v22941/254/15/q652310588_2173.jpg something ( I have made sure the pictures are static do not require a facebook login or anything , they are just user public profile pictures)

    Read the article

  • flash.display.Loader blocks on load in release build

    - by Anders
    I'm loading a swf-file from my program written in as3 using the flash.display.Loader class. When I'm using the debug build configuration in FlashDevelop everything works fine. But when I'm using the release build configuration the program freezes for around two seconds efter the loader sends the progress events and before sending the complete event. This is my program: package { import flash.display.Loader; import flash.display.Sprite; import flash.events.Event; import flash.events.ProgressEvent; import flash.net.URLRequest; import flash.system.LoaderContext; import flash.system.ApplicationDomain; import flash.text.TextField; public class Main extends Sprite { private var frameCounter:int; private var frameCounterField:TextField = new TextField; private var statusField:TextField = new TextField; function Main():void { if (stage) init(); else addEventListener(Event.ADDED_TO_STAGE, init); } private function init(e:Event = null):void { removeEventListener(Event.ADDED_TO_STAGE, init); addEventListener(Event.ENTER_FRAME, frame); frameCounterField.text = "On frame " + frameCounter.toString(); addChild(frameCounterField); statusField.y = 40; statusField.width = 300; addChild(statusField); var context:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null); var urlReq:URLRequest = new URLRequest("SomeFile.swf"); var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete); loader.load(urlReq, context); } private function frame(event:Event):void { frameCounterField.text = "On frame " + (++frameCounter).toString(); } private function onProgress(event:ProgressEvent):void { statusField.appendText("Progress on frame: " + frameCounter.toString() + " Loaded: " + event.bytesLoaded + " / " + event.bytesTotal + "\n"); } private function onComplete(event:Event):void { statusField.appendText("Completed on frame: " + frameCounter.toString() + "\n"); } } } In release I get the following output on the first frame: On frame 1 Progress on frame: 1 Loaded: 0 / 182468 Progress on frame: 1 Loaded: 65536 / 182468 Progress on frame: 1 Loaded: 131072 / 182468 Progress on frame: 1 Loaded: 182468 / 182468 After around two seconds where the program is frozen the line Completed on frame: 2 is added and the 'On frame X' counter starts ticking up. Debug build produces the same output but without the freeze. Not all swf-files I have tried loading triggers the problem. The size of the file doesn't seem to affect anything. I have tried compiling and running on another computer with the same result. What could cause this problem?

    Read the article

  • Loading a SWF dynamically causes previously loaded SWFs to misbehave

    - by Aaron
    I have run into a very strange problem with Flash and Flex. It appears that under certain circumstances, movie clips from a SWF loaded at runtime (using Loader) cannot be instantiated if another SWF has been loaded in the mean time. Here is the complete code for a program that reproduces the error. It is compiled using mxmlc, via Ensemble Tofino: package { import flash.display.*; import flash.events.*; import flash.net.*; import flash.system.*; public class DynamicLoading extends Sprite { private var testAppDomain:ApplicationDomain; public function DynamicLoading() { var request:URLRequest = new URLRequest("http://localhost/content/test.swf"); var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onTestLoadComplete); loader.load(request); } private function onTestLoadComplete(e:Event):void { var loaderInfo:LoaderInfo = LoaderInfo(e.target); testAppDomain = loaderInfo.applicationDomain; // To get the error, uncomment these lines... //var request:URLRequest = new URLRequest("http://localhost/content/tiny.swf"); //var loader:Loader = new Loader(); //loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onTinyLoadComplete); //loader.load(request); // ...and comment this one: onTinyLoadComplete(); } private function onTinyLoadComplete(e:Event = null):void { var spriteClass:Class = Class(testAppDomain.getDefinition("TopSymbol")); var sprite:Sprite = Sprite(new spriteClass()); sprite.x = sprite.y = 200; addChild(sprite); } } } With the second loading operation commented out as shown above, the code works. However, if the second loading operation is uncommented and onTinyLoadComplete runs after the second SWF is loaded, the line containing new spriteClass() fails with the following exception: TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::MovieClip@2dc8ba1 to SubSymbol. at flash.display::Sprite/constructChildren() at flash.display::Sprite() at flash.display::MovieClip() at TopSymbol() at DynamicLoading/onTinyLoadComplete()[C:\Users\...\TestFlash\DynamicLoading.as:38] test.swf and tiny.swf were created in Flash CS4. test.swf contains two symbols, both exported for ActionScript, one called TopSymbol and one called SubSymbol. SubSymbol contains a simple graphic (a scribble) and TopSymbol contains a single instance of SubSymbol. tiny.swf contains nothing; it is the result of publishing a new, empty ActionScript 3 project. If I modify test.swf so that SubSymbol is not exported for ActionScript, the error goes away, but in our real project we need the ability to dynamically load sprite classes that contain other, exported sprite classes as children. Any ideas as to what is causing this, or how to fix it?

    Read the article

  • Adobe Flex Progress Bar for LoadStyleDeclarations

    - by Max
    I'm loading a rather large swf as style with the following command: StyleManager.loadStyleDeclarations("assets/modules/"style.swf",true,false,ApplicationDomain.currentDomain); The style is loaded fine but now I would like to add a progress bar to it, but I do not know how to do so. I am rather new to Flex and found only examples referring to HTML service calls. Thank You for Your Help. It would be great to receive a small code example.

    Read the article

  • Is it possible to access a remote SWF without needing to download it?

    - by Trap
    We have a very large SWF hosted in a website which is just a repository of hundreds of movies/symbols. We load this SWF at the beginning with the Loader class but then the client will access a very few of them at that moment. Is it possible to tell the loader to download symbols only when they're needed? (as with applicationDomain.getDefinition(...)). Thanks in advance.

    Read the article

  • Mbean registered but not found in mbean Server

    - by Prisco
    I have a problem about the mbeans. I have created a simple mbean and I have registered it on the default mBeanServer that is run (Via eclipse or java -jar mbean.jar) and in the same process if I try to fouund the mbean registered with a simple query: for (ObjectInstance instance : mbs.queryMBeans(ObjectNameMbean, null)) { System.out.println(instance.toString()); } the query retuerns my mbean, but if I start another process and try to search this mbean registered the mbeas is not found! why? The approch is : (Process that is running) public static void main(String[] args) throws Exception { MBeanServer mbeanServer =ManagementFactory.getPlatformMBeanServer(); ObjectName objectName = new ObjectName(ObjectNameMbean); Simple simple = new Simple (1, 0); mbeanServer.registerMBean(simple, objectName); while (true) { wait (Is this necessary?) } } So this is the first process that is running (that has the only pourpose to registry the mbean, because there is another process that want to read these informations. So I start another process to search this mbean but nothing. I 'm not using jboss but the local Java virtual Machine but my scope is to deploy this simple application in one ejb (autostart) and another ejb will read all informations. All suggestions are really apprecciated. This example should be more useful : Object Hello: public class Hello implements HelloMBean { public void sayHello() { System.out.println("hello, world"); } public int add(int x, int y) { return x + y; } public String getName() { return this.name; } public int getCacheSize() { return this.cacheSize; } public synchronized void setCacheSize(int size) { this.cacheSize = size; System.out.println("Cache size now " + this.cacheSize); } private final String name = "Reginald"; private int cacheSize = DEFAULT_CACHE_SIZE; private static final int DEFAULT_CACHE_SIZE = 200; } Interface HelloBean (implemented by Hello) public interface HelloMBean { public void sayHello(); public int add(int x, int y); public String getName(); public int getCacheSize(); public void setCacheSize(int size); } Simple Main import java.lang.management.ManagementFactory; import java.util.logging.Logger; import javax.management.MBeanServer; import javax.management.ObjectName; public class Main { static Logger aLog = Logger.getLogger("MBeanTest"); public static void main(String[] args) { try{ MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); ObjectName name = new ObjectName("ApplicationDomain:type=Hello"); Hello mbean = new Hello(); mbs.registerMBean(mbean, name); // System.out.println(mbs.getAttribute(name, "Name")); aLog.info("Waiting forever..."); Thread.sleep(Long.MAX_VALUE); } catch(Exception x){ x.printStackTrace(); aLog.info("exception"); } } } So now I have exported this project as jar file and run it as "java -jar helloBean.jar" and by eclipse I have modified the main class to read informations of this read (Example "Name" attribute) by using the same objectname used to registry it . Main to read : public static void main(String[] args) { try{ MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); ObjectName name = new ObjectName("ApplicationDomain:type=Hello"); System.out.println(mbs.getAttribute(name, "Name")); } catch(Exception x){ x.printStackTrace(); aLog.info("exception"); } } But nothing, the bean is not found.

    Read the article

  • Add something to symbol in dynamicly loaded swf (ActionScript 3)

    - by user1468671
    I have a program written in Flash Builder with Flex 4.6 sdk and swf movie with some symbols inside. Those symbols moving around the stage. What I need is load that swf in my program and replace one of those symbols to my bitmap and show whole swf in flashContainer. There is my code for now: var swfLoader:Loader = new Loader(); var bgUrl:URLRequest = new URLRequest("testMovie.swf"); swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, function(event: Event) : void { var movie: MovieClip = event.target.content; var headClass: Class = movie.loaderInfo.applicationDomain.getDefinition("headSymbol") as Class; var head:MovieClip = new headClass() as MovieClip; head.addChild(bmp); flashContainer.source = movie; }); but in flashContainer showed old movie. If I do flashContainer.source = head; then only head with my bmp appears. Need help. And sorry for my bad English.

    Read the article

  • How to load an external swf to the main stage from an instanced child class?

    - by RaamEE
    Hi, I am trying to get an instance of a class to the load an external swf and show it. So far I have the following: 1) I wrote a class that uses the Loader class to load an external swf "loadExtSWF". 2) I have a fla named "MainSWF.fla" that uses a document class "MainSWF.as". 3) I have the MainSWF.as file that instances "loadExtSWF" and calls loadExtSWF.startLoad to load the swf. This almost works. The instance of loadExtSWF loads the external swf, but the swf is not displayed. If I replace the fla's document class with loadExtSWF (this has an empty constructor) instead of MainSWF, and run loadExtSWF.startLoad, then the external swf is loaded and displayed. It seems that the way I initially do it, loads the swf to the wrong stage (?). Any ideas? Thanks for the help. Bye, RaamEE P.S. If you replace the document class for test_tsscreen from test_tsscreen.as to TSScreen.as, and remove the comment inside the test_tsscreen's constructor, the swf will be loaded. my code is: file test_as3.swf an external as3 swf file. file test_tsscreen.fla the fla is empty and references test_tsscreen.as as its document class. file test_tsscreen.as package { import flash.display.MovieClip; import TSScreen; public class test_tsscreen extends MovieClip{ var tsScreen1; public function test_tsscreen(){ // var tsScreen1:TSScreen = new TSScreen(10,10,100,100,0.5,0); var tsScreen1:TSScreen = new TSScreen(); tsScreen1.startLoad(this.stage); } } } file TSScreen.as package { import flash.display.MovieClip; import flash.display.*; import flash.net.URLRequest; import flash.system.ApplicationDomain; import flash.system.LoaderContext; import flash.display.Loader; import flash.events.Event; import flash.events.ProgressEvent; public class TSScreen extends MovieClip implements ITSScreenable{ public function TSScreen():void{ // startLoad(this); //Look important comment in above text } function startLoad(_this:Stage) { var mLoader:Loader = new Loader(); var mRequest:URLRequest = new URLRequest("test_as3.swf"); mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler); mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler); _this.parent.addChild(mLoader); mLoader.load(mRequest); trace(this.name); trace(_this.name); } function onCompleteHandler(loadEvent:Event) { addChild(loadEvent.currentTarget.content); } function onProgressHandler(mProgress:ProgressEvent) { var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal; trace(percent); } } }

    Read the article

1