EDIT: Neues Problem angehängt - ArgumentError 2025 [Flash 9]
| Beiträge: 23 Registriert: Jan 2011
| 26.02.2011, 15:45
EDIT: Bitte diesen und die nächsten zwei Posts ignorieren, da Teil eines anderen Problems.
Ich bins wieder. -.-
ActionScript: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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | stop();
if (stage){
init();
}
else{
addEventListener(Event.ADDED_TO_STAGE, init);
}
function init(e:Event=null){
ssCore.init();
ssDefaults.synchronousCommands = true;
//ssDebug.trace(ssGlobals.ssStartDir);
var imgLoader:Loader = new Loader();
var imgURL:String;
var tempURL:String;
imgLoadBtn.addEventListener(MouseEvent.CLICK, imgLClick);
imgUnloadBtn.addEventListener(MouseEvent.CLICK, imgUClick);
function imgLClick(e:MouseEvent):void{
ssDebug.trace("loading button was clicked");
tempURL = urlTxt.text;
ssDebug.trace("tempURL: "+tempURL);
loadIMG(tempURL);
}//end function
function imgUClick(e:MouseEvent):void{
ssDebug.trace("unloading button was clicked");
tempURL = urlTxt.text;
ssDebug.trace("tempURL: "+tempURL);
unloadIMG(tempURL);
}//end function
function loadIMG(imgURL):void{
ssDebug.trace("loadIMG() initiated");
//if already exists, refresh
if(Boolean(stage.getChildByName(imgURL.slice(0,-4)))){
stage.removeChild(getChildByName(imgURL.slice(0,-4)));
}//end if
//ssDebug.trace(ssGlobals.ssStartDir+"\\img\\"+imgURL);
tempURL = imgURL;
ssDebug.trace("imgURL: "+imgURL);
ssDebug.trace("tempURL: "+tempURL);
imgLoader.load(new URLRequest("\\img\\"+imgURL)); //ssGlobals.ssStartDir+"\\img\\"+imgURL
imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onImgLoaded);
ssDebug.trace("loadIMG() completed");
}//end function
function onImgLoaded(e:Event):void{
ssDebug.trace("onImgLoaded() initiated");
var cgHolder:MovieClip = new MovieClip;
cgHolder.addChild(imgLoader.content);
cgHolder.x = 10;
cgHolder.y = 10;
ssDebug.trace("tempURL: "+tempURL);
ssDebug.trace("name about to be given");
cgHolder.name = tempURL.slice(0,-4);
ssDebug.trace("name given: "+cgHolder.name);
stage.addChildAt(cgHolder,0);
ssDebug.trace("onImgLoaded() completed");
}//end function
function unloadIMG(imgURL):void{
ssDebug.trace("unloadIMG() initiated");
ssDebug.trace("imgURL: "+imgURL);
stage.removeChild(getChildByName(imgURL));
ssDebug.trace("unloadIMG() completed");
}//end function
}//end init
|
Flashs Antwort darauf:
ActionScript:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | loading button was clicked
tempURL: img.jpg
loadIMG() initiated
imgURL: img.jpg
tempURL: img.jpg
loadIMG() completed
onImgLoaded() initiated
tempURL: img.jpg
name about to be given
name given: img
onImgLoaded() completed
unloading button was clicked
tempURL: img
unloadIMG() initiated
imgURL: img
TypeError: Error #2007: Parameter child darf nicht 'null' sein.
at flash.display::DisplayObjectContainer/removeChild()
at MethodInfo-978()
at MethodInfo-975()
|
Hab ich da was falsch verstanden und das Geladene lässt sich gar nicht so ansprechen oder liegt das Problem wo anders? | Geändert von Tom786 am 02.03.11 um 12:19 Uhr | |
| | Beiträge: 1776 Wohnort: Laimbach 6 1/2 Registriert: Nov 2002
| 27.02.2011, 03:54
|
|