J'ai une application AIR développée sous Flex AS3.
Le but de cette application est de lancer un SWF externe. J'ai les messages d'erreur suivants :
"Type Coercion failed: cannot convert flash.display::Loader@623e201 to mx.core.IUIComponent."
Puis
"Loader.loadBytes() is not permitted to load content with executable code."

Voici le code
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="onLoadImage()">
 
<mx:Script>
	<![CDATA[
		import mx.controls.Alert;
import flash.display.*;
 
 
 
private var fileReferenceLoad:FileReference = new FileReference();
 
private function onLoadImage():void
{
    var f:FileFilter = new FileFilter("Images", "*.swf;*.gif;*.png;*.jpeg");
    fileReferenceLoad.browse([f]);
    fileReferenceLoad.addEventListener(Event.SELECT,onFileSelect);
    fileReferenceLoad.addEventListener(Event.COMPLETE,onFileComplete);
}
private function onFileSelect(event:Event):void
{
    fileReferenceLoad.load();
}
 
private function onFileComplete(event:Event):void
{
var byteArray:ByteArray = fileReferenceLoad.data;
var loader:Loader = new Loader(); 
 
var loaderContext:LoaderContext = new LoaderContext(false); 
loaderContext.allowLoadBytesCodeExecution = true; 
loader.loadBytes(byteArray,loaderContext);
addChild(loader);
 }
	]]>
</mx:Script>
 
 
 
</mx:WindowedApplication>
Help !!!