Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Converting onClipEvent (enterFrame) to Actionscript 3

New Here ,
Mar 23, 2015 Mar 23, 2015

I have an old FLA from another designer ca. 2009 or so written with Actionscript 2.0. I've been successful in converting most of it to Actionscript 3.0 to be published in HTML5 except this one function attached to a sprite which changes the transparency of the movie clip based on mouse proximity. I haven't used Flash much in recent years so any help is greatly appreciated!

onClipEvent (enterFrame)

{

    pointAtWhichAlphaReaches0 = 200;

    hyp = Math.sqrt(_xmouse * _xmouse + _ymouse * _ymouse);

    setProperty("", _alpha, 100 - hyp / pointAtWhichAlphaReaches0 * 100);

    updateAfterEvent(mouseMove);

}

TOPICS
ActionScript
1.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 24, 2015 Mar 24, 2015
LATEST

attached to that object's timeline (which is poor coding):

var pointAtWhichAlphaReaches0:int=200;

var hyp:Number;

this.addEventListener(Event.ENTER_FRAME,f);

function f(e:Event):void{

    hyp = Math.sqrt(mouseX * mouseX + mouseY * mouseY);

this.alpha=100 - hyp / pointAtWhichAlphaReaches0 * 100;

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines