开发者

as3 swap depth movieclips in fullscreen

开发者 https://www.devze.com 2023-04-12 14:04 出处:网络
hi I asked this question yesterday but I found out that my problem is using fullscreen my goal is 2 mc 2 buttons :

hi I asked this question yesterday but I found out that my problem is using fullscreen

my goal is 2 mc 2 buttons : if btn 1 is clicked mc1 fullscreen and mc2 appears 开发者_开发问答at the right bottom corner on top of mc1 if btn 2 is clicked mc2 fullscreen and mc1 appears at the right bottom corner on top of mc2

stage.swapChildren or setChildIndex is the way but with the fullScreen I had this error appears

ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller. at flash.display::DisplayObjectContainer/swapChildren() at smgPlayercs5_fla::MainTimeline/setFullscreen() at smgPlayercs5_fla::MainTimeline/full() at flash.display::Stage/set_displayState() at flash.display::Stage/set displayState() at smgPlayercs5_fla::MainTimeline/goFullScreen() at smgPlayercs5_fla::MainTimeline/goLiveFullScreen()

how can I fix this ???


The problem is swapChildren requires a parent/child relationship, and the child you're trying to move isn't a child of what you're calling.

This might be clearer if you imagine MovieClips as folders on your hard drive. By default swapChildren() called on its own will refer to the MainTimeline of your document.

For example swapChildren(A, B) actually translates to this.swapChildren(A, B)

If your stage hierarchy looked like this...

stage.videoPlayer.mc1
stage.videoPlayer.mc2

Then you would type:

videoPlayer.swapChildren(mc1, mc2)
0

精彩评论

暂无评论...
验证码 换一张
取 消