我正在制作应用程序/程序,通过单击UI上的按钮,您可以使用两个基本功能设计自己的艺术作品,我们将称之为“模式'现在。AS3 - 在Flash中拖动和旋转的工具工具模式
镊子模式:您可以在此模式下拖动选定的一组对象。 旋转模式:这允许您旋转舞台上的一组特定电影剪辑。
分配它。 我希望它能够在旋转模式或镊子模式处于活动状态时另一个被禁用(启用= false)或达到此效果。我已经到达了我需要在方法旋转或方法镊子下进行分组的道路上的叉子。当点击镊子时,你移动的东西(仅),当选择旋转模式时,你可以旋转电影剪辑...(只)这工作正常,直到你离开旋转模式后镊子,你仍然可以旋转电影剪辑!任何人都可以对此有所了解,所以当我离开这种模式时,你仍然可以旋转它?任何可以提出组织这种功能的最佳方式吗?
感谢您的帮助 - 我是AS3新手。
// UI btns TOOLS ---------------------
spinny_mc.addEventListener(Event.ENTER_FRAME, fl_RotateContinuously);
function fl_RotateContinuously(event:Event)
{
spinny_mc.rotation += 20;
}
rotate_btn.visible = true;
tweezer_btn.visible = false;
//----- rotate tool
rotate_btn.addEventListener(MouseEvent.CLICK, spinmode);
function spinmode(event:MouseEvent):void
{
Mouse.hide();
stage.addEventListener(MouseEvent.MOUSE_MOVE,followspin);
function followspin(evt:MouseEvent)
{
spinny_mc.x = mouseX;
spinny_mc.y = mouseY;
rotate_btn.visible = false;
tweezer_cur.visible = false;
tweezer_btn.visible = true;
rotate_btn.enabled = true;
tweezer_btn.enabled = false;
skullface_mc.addEventListener(MouseEvent.CLICK, turnerbone);
function turnerbone(event:MouseEvent):void
{
skullface_mc.rotation+=45;
}
}
}
// ------------------------ tweeze tool
Mouse.hide();
stage.addEventListener(MouseEvent.MOUSE_MOVE,follow);
function follow(evt:MouseEvent){
tweezer_cur.x = mouseX;
tweezer_cur.y = mouseY;
}
tweezer_btn.addEventListener(MouseEvent.CLICK, tweezer);
function tweezer(event:MouseEvent):void
{
Mouse.hide();
stage.addEventListener(MouseEvent.MOUSE_MOVE,tweezer);
function tweezer(evt:MouseEvent){
tweezer_cur.x = mouseX;
tweezer_cur.y = mouseY;
rotate_btn.visible = true;
tweezer_cur.visible = true;
tweezer_btn.visible = false;
spinny_mc.visible = false;
rotate_btn.enabled = false;
tweezer_btn.enabled = true;
}
}
您好,感谢您的指针。我得到了一种感觉,一种直觉!有了嵌套功能,它会让我更加烦恼,我需要在舞台上使用大约20个物体。这就是为什么我认为我会来到这里,作为像我这样比我更了解AS3的人 - 我还是新手,和AS2有很大不同。谢谢杰森,我会在接下来的几天里修补一下。 :-) – user3082874
如果可以,请开始使用ActionScript 3.0 Bible。 AS3有很多时髦的新功能,可以派上用场。可以说,它已经成为全面的面向对象语言。 http://www.amazon.com/ActionScript-3-0-Bible-Roger-Braunstein/dp/0470135603 – CodeMouse92