error 2007, load swf with Flash UI component error

TypeError: Error #2007: 參數 child 不能是 Null。
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/drawBackground()
at fl.controls::BaseButton/draw()
at fl.core::UIComponent/drawNow()
at fl.controls::ScrollBar/draw()
at fl.controls::UIScrollBar/draw()
at fl.core::UIComponent/drawNow()
at fl.controls::TextArea/updateScrollBars()
at fl.controls::TextArea/drawLayout()
at fl.controls::TextArea/draw()
at fl.core::UIComponent/callLaterDispatcher()

TypeError: Error #2007: 參數 child 不能是 Null。

當你用了 load swf,而咁o岩裡面個 swf 有用到 UI component d 野
(e.g. scrollbar, checkbox 等)
你用 main 個個 swf load 佢,本身都應該相安無事
但你搞下個 fl library,例如玩下 focusManager,又或者 (我估) add 其他 UI component
咁佢就會鬧你 load swf 個個搵唔到適當既 UI component
其實無咩野,出下 error,想解決就係 main library 都加埋 個個 UIcomponent la~

duplicate MC……自己 load 自己

http://asgrocery.blogspot.com/2010/02/actionscript-3-duplicate-stage-instace.html#more

很有趣的構思

[actionscript3]
package {
import flash.display.Loader;
import flash.display.MovieClip;
import flash.display.Stage;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.net.URLLoader;
import flash.net.URLLoaderDataFormat;
import flash.net.URLRequest;
import flash.utils.ByteArray;

/**
* …
* @author Focus1921
*
* 複製無綁定類別movie clip場景實體(stage instance)實作demo(fla文件類別)
*/
public class DocTest extends MovieClip {
//stage instance
public var test_box_mc:MovieClip; //場景上僅有的movie clip, 實體名稱test_box_mc

private var ba:ByteArray; //儲存自己這個swf的byte array
private var ldr:Loader; //建一個loader來load ba
private var tmpX:Number;
private var tmpY:Number;

/**
* 建構式
*/
public function DocTest() {
if (stage) {
init();
}else {
addEventListener(Event.ADDED_TO_STAGE, init);
}
}

private function init(e:Event = null):void {
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;

//確保主場景load只load自己一次,避免溢位
if (parent is Stage) {
trace("parent is Stage");
//建構url loader(binary)去load自己的byte array
var _urlLoader:URLLoader = new URLLoader();
_urlLoader.dataFormat = URLLoaderDataFormat.BINARY;
//trace(root.loaderInfo.url);
_urlLoader.load(new URLRequest(root.loaderInfo.url));
_urlLoader.addEventListener(Event.COMPLETE, onURLLdrComplete);
}

//建構loader, 註冊complete完成偵聽
ldr = new Loader();
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, onLdrComplete);

//stage註冊click偵聽
stage.addEventListener(MouseEvent.CLICK, onStageClick);
}

//—Event Handler—————————————————————————–

private function onURLLdrComplete(e:Event):void {
e.currentTarget.removeEventListener(Event.COMPLETE, onURLLdrComplete);
//把load到的byte array存起來
ba = e.currentTarget.data;
}

private function onLdrComplete(e:Event):void {
//用實體名稱去抓到要複製的movie clip,每次load完都會傳不同的引用
var _mc:MovieClip = <div style="display: inline; height: auto; position: absolute; visibility: hidden; width: auto; ">MovieClip</div>MovieClip(ldr.content).getChildByName("test_box_mc") as MovieClip;
//屬性設定不同的值,證明的確不是同一個引用
_mc.x = tmpX;
_mc.y = tmpY;
_mc.alpha = Math.random();
//加入顯示清單
addChild(_mc);
}

private function onStageClick(e:MouseEvent):void {
//把點擊座標記起來,當作複製後的mc的座標
tmpX = e.stageX;
tmpY = e.stageY;
//loader去load(loadBytes)存起來的byte array(ba)
ldr.loadBytes(ba);
}

}

}
[/actionscript3]

Hack Flash Projector to change some value (e.g. title name)

Player without minimize, maximize and close buttons when not full screen:

Using third party projector tools such as mProjector, Zinc, SWF Studio or Screenweaver. Flash alone cannot do that.

Another way to hide the minimize, maximize and close buttons (and also, if you want, to modify/remove others menus, dialog windows etc.), but only applicable at a projector file, is to use a resource editor program, also called ‘hacking’ program. With such programs (for example: ‘XN Resource Editor’, ‘Resource Hacker’), you can usually ‘hack’ Win32 PE files (modules); that is why you will be able to edit only the projector file.

http://www.wilsonc.demon.co.uk/d10resourceeditor.htm

http://www.angusj.com/resourcehacker/

Using swc rather than Embed tag

http://www.arpitonline.com/blog/2009/03/21/flex-builder-tip-use-swcs-for-image-assets-not-embed-metatags-for-pure-actionscript-projects/

PS

What is Flex Assets?

When using [Embed] to store some bitmap, it will extends BitmapAssets, etc……….

so somethime may not want to use Embed tag, then u can import the Asset class inside and extends by yrself!

http://www.ultrashock.com/forums/flex/embed-flex-assets-without-using-flex-123405.html