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

Menu animation not stopping and submenu not showing

New Here ,
Sep 22, 2015 Sep 22, 2015

Hello,

I would be most grateful of your help.  I'm working on a project for my students, using CS6, AS3 and we are to create a basic button navigation with a submenu.  My problem is that the animation won't stop at the given keyframes and just runs on.  The submenu doesn't show up either.  Thanks in advance for your help.

Here is the AS3 code:

import fl.transitions.Tween;

import fl.transitions.easing.*;

import flash.events.MouseEvent;

var scene:String="";

var submenuVisible:Boolean=false;

var myTweenAlpha:Tween;

submenu.mouseEnabled=false;

submenu.mouseChildren=false;

stop();

btn_home.addEventListener(MouseEvent.CLICK, NavigateHome);

function NavigateHome(event:MouseEvent):void

{

  scene="Home";

  submenuVisible=false;

  CheckSubmenu();

  play()

}

btn_subjects.addEventListener(MouseEvent.CLICK, NavigateSubjects);

function NavigateSubjects (event:MouseEvent):void

{

  scene="Subjects";

  submenuVisible=true;

  CheckSubmenu();

  play();

}

btn_about.addEventListener(MouseEvent.CLICK, NavigateAbout);

function NavigateAbout(event:MouseEvent):void

{

  scene="About";

  submenuVisible=false;

  CheckSubmenu();

  play();

}

btn_enquiry.addEventListener(MouseEvent.CLICK, NavigateEnquiry);

function NavigateEnquiry (event:MouseEvent):void

{

  scene="Enquiry";

  submenuVisible=false;

  CheckSubmenu();

  play();

}

function CheckSubmenu():void

{

  if (submenuVisible==true)

  {

  myTweenAlpha= new Tween(submenu, "alpha",

Strong.easeInOut, submenu.alpha, 1, 1.5, true);

  submenu.mouseEnabled=true;

  submenu.mouseChildren=true;

  }

  else if (submenuVisible==false)

  {

  myTweenAlpha= new Tween(submenu, "alpha",

Strong.easeInOut, submenu.alpha, 0, 1.5, true);

  submenu.mouseEnabled=false;

  submenu.mouseChildren=false;

  }

}

submenu.btn_subject1.addEventListener(MouseEvent.CLICK),

NavigateSubject1);

function NavigateSubject1 (event:MouseEvent):void

{

  scene="Subject1";

  play();

}

submenu.btnsubject2.addEventListener(MouseEvent.CLICK

NavigateSubject2);

function NavigateSubject2 (event:MouseEvent):void

{

  scene="Subject2";

  play();

}

submenu.btn_subject3.addEventListener(MouseEvent.CLICK,

NavigateSubject3);

function NavigateSubject3 (event:MouseEvent):void

{

  scene="Subject3";

  play();

}

submenu.btn_subject4.addEventListener(MouseEvent.CLICK,

NavigateSubject4);

function NavigateSubject4 (event:MouseEvent):void

{

  scene="Subject4";

  play()

}

submenu.btn_subject5.addEventListener(MouseEvent.CLICK,

NavigateSubject5);

function NavigateSubject5 (event:MouseEvent):void

{

  scene="Subject5";

  play();

}

TOPICS
ActionScript
238
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
LEGEND ,
Sep 22, 2015 Sep 22, 2015

I don't see anything in the code that looks like it is supposed to stop an animation.  Where does that occur?  Also, as far as the submenu not appearing, I cannot answer for that, but I would be concerned with it never disappearing if it does ever appear. YOu might want to check the logic you have for that to make sure you are telling it to appear when you want it to. Also, you are using 1.5 as a parameter for alpha but after 1 you would be wasting effort as visually the alpha cannot get any stronger than 1.

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
New Here ,
Sep 22, 2015 Sep 22, 2015
LATEST

Hi Ned,

Thank you very much for your feedback and I'll check out those points.

Regards,

Anna.

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