如何使用Flash CS5和ActionScript 3切换Flash MovieClip对象中的场景?
答案 0 :(得分:1)
嗨Dani,
首先,不建议在AS3中的MovieClip对象内进行编码,不建议使用场景。
为什么?
足够的说话,这是你需要的帮助。
如何切换Flash MovieClip对象中的场景
此代码适用于MovieClip框架
// === Let's put the stage in a variable (cleaner) ===
var main:MovieClip = this.parent as MovieClip;
// this.parent will return the DisplayObject of parent the current clip.
// You need to cast [... as MovieClip] to not cause errors because Flash
// thinks it is only a DisplayObject
// === Here's the interresting part ===
main.gotoAndPlay(0, "Scene 2");
// We tell the main timeline to go to frame 0 in the "Scene 2"
// Be cautious, it must be spelled exactly as displayed in Flash (IDE)
不要忘记:更深的是你的剪辑(在剪辑中多次嵌入),你需要更多的“父”。
var main:MovieClip = this.parent.parent as MovieClip;
// If your object is inside a MovieClip who is itself in a MovieClip
// Tip: How much time you need to push the Back button to go to the timeline
// is the number of parents you need to write.
希望得到这个帮助。如果您有任何疑问,请发表评论!