Flash AS3 to make a rotating circular web page navigation

Source: Internet
Author: User
Tags addchild array

Core tips: Flash AS3 to make a rotating circular web navigation tutorial for personalities.

Flash AS3 to make a rotating circular web page with personality.

1. Draw a black rectangle with rectangular tool, convert to MC movie clip, open Properties window

2. Double-click the movie clip to edit it, use the Text tool, set as dynamic text, draw an area, set the color to white, and name the instance named Abelbtn.

3, back to scene 1, delete the newly created movie clips.

4, we select the first frame, and then open the Action panel, enter the following code, mainly to import Tweenlite engine.

Import com.greensock.*;

Import com.greensock.easing.*;

5, and then create a number that dynamically invokes the item text for each menu.

var menu_items:array = ["Home", "About ME", "PORTFOLIO", "BLOG", "contact"];

var menu:sprite = new Sprite ();

Menu.x= STAGE.STAGEWIDTH/2;

MENU.Y=STAGE.STAGEHEIGHT/2;

AddChild (menu);

6, use a function Buildmenu to implement each menu item.

function Buildmenu () {

var Btn:mybutton;

var angle:int=360/menu_items.length;

for (var i:int = 0; i< menu_items.length; i++) {

BTN = new MyButton ();

Btn.buttonmode=true;

Btn.labelBtn.text = Menu_items[i];

Btn.mousechildren=false;

Menu.addchild (BTN);

Tweenlite.to (btn,2,{rotation:-i*angle,ease:bounce.easeout});

}

}

7, the last to add a listener click event code.

Menu.addeventlistener (Mouseevent.click,clickhandler);

function ClickHandler (e:mouseevent): void{

To do ...

Trace (MyButton (e.target). Labelbtn.text);

}

8, all the code is as follows.

Import com.greensock.*;

Import com.greensock.easing.*;

var menu_items:array = ["Home", "About ME", "PORTFOLIO", "BLOG", "contact"];

var menu:sprite = new Sprite ();

Menu.x= STAGE.STAGEWIDTH/2;

MENU.Y=STAGE.STAGEHEIGHT/2;

AddChild (menu);

Buildmenu ();

function Buildmenu () {

var Btn:mybutton;

var angle:int=360/menu_items.length;

for (var i:int = 0; i< menu_items.length; i++) {

BTN = new MyButton ();

Btn.buttonmode=true;

Btn.labelBtn.text = Menu_items[i];

Btn.mousechildren=false;

Menu.addchild (BTN);

Tweenlite.to (btn,2,{rotation:-i*angle,ease:bounce.easeout});

}

}

Menu.addeventlistener (Mouseevent.click,clickhandler);

function ClickHandler (e:mouseevent): void{

To do ...

Trace (MyButton (e.target). Labelbtn.text);

1 Full text reading tips: Try the "←→" button, turn the page more convenient Oh!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.