Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




AS2: Menu For Loop-can't Add Button Functionality...



I'm working on a portfolio website for a Creative Director and I've made submenus that attach and animate in when you roll over 'Print', 'Online', and 'Multimedia'. Each menu is attached to the stage from one movie clip using generic code and a 'for' loop to attach a list of buttons from one generic button movie clip. The problem I'm having is that I'm unable to add button functionality to these button movie clips that have been attached using the 'for' loop. I've tried adding the functionality in several different timelines including the timeline of the button itself, the menu movie clip, in with the 'for' loop and it just doesn't work. Can anyone take a look and help me??

(check attached)



FlashKit > Flash Help > Flash ActionScript
Posted on: 09-03-2004, 08:28 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

XML Menu Has No Functionality
Hi fellas

Im a novice in the realms of AS3 an have been trying to get some functionality out of an xml menu I produced from a tutorial. the menu looks fine and the rollovers work perfectly but I cant getthe correct script to enable the buttons to navigate to another swf or even just to gotoAndStop at a certain frame. The code im about to post has some go to frame functionality at the end simply because I was running out of ideas.

If you coud show me the loop i need to use in order to identify which menu button shoud direct where id be very grateful.

XML

<?xml version="1.0" encoding="iso-8859-1"?>
<site>
<links>
<link name="Home" frame="1" href="menu.swf"/>
<link name="Graphics" frame="2" href="Portfolio.swf"/>
<link name="Flash" frame="3" href="menu.swf"/>
<link name="Contact" frame="4" href="Portfolio.swf"/>
</links>
</site>

I previesly had id where frame is now.

Actionscript



//Imports needed for animation
import fl.transitions.Tween;
import fl.transitions.easing.*;

var me = this;
//XML file path
//You can use the following path as well if you want...
var xmlPath:String = "site.xml";

//The XML data will be inserted into this variable
var xmlData:XML = new XML();

//Array used for the tween so they won't get garbage collected
var tweensArray:Array = new Array();
//Used later when we animate the buttons
var buttonTween:Tween;

//load
var xmlLoader = new URLLoader();
xmlLoader.load (new URLRequest(xmlPath));
xmlLoader.addEventListener (Event.COMPLETE, LoadXML);


//This function is called when the XML file is loaded
function LoadXML (e:Event):void {

//Make sure we're not working with a null loader
if ((e.target as URLLoader) != null ) {
//Insert the loaded data to our XML variable
xmlData = new XML(xmlLoader.data);
xmlData.ignoreWhitespace = true;
//Call the function that creates the whole menu
createMenu ();
}
}
//-------------------------------------------------
function createMenu ():void {
//This will be used to represent a menu item
var menuItem:MenuItem;
//Counter
var i:uint = 0;

//Loop through the links found in the XML file
for each (var link:XML in xmlData.links.link) {

menuItem = new MenuItem();

//Insert the menu text (link.@name reads the link's "name" attribute)
menuItem.menuLabel.text = link.@name;

//If the text is longer than the textfield, autosize so that the text
//is treated as left-justified text
menuItem.menuLabel.autoSize = TextFieldAutoSize.LEFT;

//Insert the menu button to stage
menuItem.x = 20;
menuItem.y = 30 + i*40;
menuItem.alpha=.5

//Make the button look like a button (hand cursor)
menuItem.buttonMode = true;
menuItem.mouseChildren = false;

//Add event handlers (used for animating the buttons)
menuItem.addEventListener (MouseEvent.MOUSE_OVER, mouseOverHandler);
menuItem.addEventListener (MouseEvent.MOUSE_OUT, mouseOutHandler);
menuItem.addEventListener (MouseEvent.MOUSE_UP, mouseUpHandler);
// Here is where we listen for the 'onPress' event
//var listener = new Object();


addChild (menuItem);

//Increment the menu button counter, so we know how many buttons there are
i++;
}
}
//Function is called when the mouse is over a menu button
function mouseOverHandler (e:Event):void {

//Double the width
buttonTween = new Tween(e.target, "scaleX", Elastic.easeOut, 1, 1.5, 1, true);
}

//Function is called when the mouse moves out from the menu button
function mouseOutHandler (e:Event):void {

//Tween back original scale
buttonTween = new Tween(e.target, "scaleX", Elastic.easeOut, e.target.scaleX, 1, 1, true);
}
//Function is called when the button is clicked
function mouseUpHandler (e:Event):void {
var frame = xmlData.links.frame;
me.useFrame(frame);
};
//trace(xmlData.links.link.@href);

function useFrame(frame) {
me.frameNumber.text = "frame "+frame;
me.gotoAndStop(fr

Dynamic Menu - How To Add Functionality?
I'm trying to use Geoff Stearns's dynamic menu .fla but I don't know to add functionality to individual buttons in the dynamically created menu.

I want to launch new flash windows from the portfolio buttons, a new window would contain a specific .swf. I also want to send an email from a contact button. I know I can use the array names of the main section and sub-section to identify the button the event came from, but how do I write the function for just that button?

Here is the code:
onClipEvent (load) {
// -- set up names of main items here
// -- you can add as many new sections as you want (or your computer can handle)
mainSections = new Array("portfolio", "resume", "contact");
// -- one array for each main Section -
subSection0 = new Array("zero", "One", "Two", "Three");
subSection1 = new Array("zero", "One");
subSection2 = new Array("zero", "One", "Two");
// --
// --
// -- build the main buttons
for (i=0; i<mainSections.length; i++) {
attachMovie("mainButton", "main"+i, i+100);
myButton = this["main"+i];
myButton.subs = this["subSection"+i];
myButton.button.value = mainSections[i];
myButton._y = myButton._height*i;
// -- build subsection buttons for each main button
for (x=0; x<myButton.subs.length; x++) {
myButton.attachMovie("subButton", "sub"+x, x);
mySub = myButton["sub"+x];
mySub.button.value = myButton.subs[x];
mySub.button.outXpos = myButton._width+(mySub._width*x);
}
}
// -- function that opens the subsection on rollover
function openSubs(target) {
for (i=0; i<this[target].subs.length; i++) {
subMenuCounter = 0;
this[target]["sub"+i].button.newX = this[target]["sub"+i].button.outXpos;
currentOpen = target;
}
}
// -- close subsections function
function closeSubs(target) {
for (i=0; i<this[target].subs.length; i++) {
this[target]["sub"+i].button.newX = this[target]["sub"+i].button.oXpos;
}
}
// - this is the fuction you would change to load content, or add more functionality to the buttons
function doSubSection(target, sub) {
_root.currentSelection = target+" "+sub;
closeSubs(currentOpen);
}
}
onClipEvent (enterFrame) {
// -- a timer that closes the menus after a certain amount of time
subMenuCounter++;
if (subMenuCounter>200) {
closeSubs(currentOpen);
subMenuCounter = 0;
}
}
onClipEvent (mouseUp) {
// -- this closes the curently open submenu if the user clicks outside of the menu
if (!this.hitTest(_root._xmouse, _root._ymouse)) {
closeSubs(currentOpen);
}
}

Menu Functionality Question
Ok, so I'm pretty new to ActionScript 3.0 and unfortunately have no friends that know anything about it. This may and probably is not the best way to set this up but here is my problem. This is just something I'm doing for myself to help me get a better understanding of how things work.

I want each menu item to move when clicked, what I do not want is for any other menu items to be able to be clicked until the original item clicked finishes it's move. Then I want them to be able to be clicked and then again nothing else be able to be clicked until it finishes it's move. Any help would be great. If I'm way off with my method I would like to know that as well so I can get on the road to learning how to do it the right way. If there is an easy way to do this (which there probably is), I would love to know that as well. Thanks in advance!

Code:

Code:

import fl.transitions.Tween;
import fl.transitions.easing.*;

var navMoveIn:Tween;
var navMoveOut:Tween;

home_btn.addEventListener(MouseEvent.CLICK, homeMove);
two_btn.addEventListener(MouseEvent.CLICK, twoMove);
three_btn.addEventListener(MouseEvent.CLICK, threeMove);
four_btn.addEventListener(MouseEvent.CLICK, fourMove);
five_btn.addEventListener(MouseEvent.CLICK, fiveMove);
six_btn.addEventListener(MouseEvent.CLICK, sixMove);
seven_btn.addEventListener(MouseEvent.CLICK, sevenMove);


//////////////////////////////////////////////////////////////////// ONE MOVE //

function homeMove(event:MouseEvent):void {
   navMoveIn = new Tween(home_btn,"x",Bounce.easeOut,30,50,1,true);
   navMoveIn = new Tween(home_btn,"y",Bounce.easeOut,20,30,1,true);
   home_btn.removeEventListener(MouseEvent.CLICK, homeMove);
   home_btn.addEventListener(MouseEvent.CLICK, homeMoveOut);
   two_btn.addEventListener(MouseEvent.CLICK, twoMove);
   three_btn.addEventListener(MouseEvent.CLICK, threeMove);
   four_btn.addEventListener(MouseEvent.CLICK, fourMove);
   five_btn.addEventListener(MouseEvent.CLICK, fiveMove);
   six_btn.addEventListener(MouseEvent.CLICK, sixMove);
   seven_btn.addEventListener(MouseEvent.CLICK, sevenMove);


   if (two_btn.x == 100) {
      navMoveOut = new Tween(two_btn,"x",Bounce.easeOut,100,80,1,true);
      navMoveOut = new Tween(two_btn,"y",Bounce.easeOut,30,20,1,true);
      two_btn.removeEventListener(MouseEvent.CLICK, twoMoveOut);
   }
   if (three_btn.x == 150) {
      navMoveOut = new Tween(three_btn,"x",Bounce.easeOut,150,130,1,true);
      navMoveOut = new Tween(three_btn,"y",Bounce.easeOut,30,20,1,true);
      three_btn.removeEventListener(MouseEvent.CLICK, threeMoveOut);
   }
   if (four_btn.x == 200) {
      navMoveOut = new Tween(four_btn,"x",Bounce.easeOut,200,180,1,true);
      navMoveOut = new Tween(four_btn,"y",Bounce.easeOut,30,20,1,true);
      four_btn.removeEventListener(MouseEvent.CLICK, fourMoveOut);
   }
   if (five_btn.x == 250) {
      navMoveOut = new Tween(five_btn,"x",Bounce.easeOut,250,230,1,true);
      navMoveOut = new Tween(five_btn,"y",Bounce.easeOut,30,20,1,true);
      five_btn.removeEventListener(MouseEvent.CLICK, fiveMoveOut);
   }
   if (six_btn.x == 300) {
      navMoveOut = new Tween(six_btn,"x",Bounce.easeOut,300,280,1,true);
      navMoveOut = new Tween(six_btn,"y",Bounce.easeOut,30,20,1,true);
      six_btn.removeEventListener(MouseEvent.CLICK, sixMoveOut);
   }
   if (seven_btn.x == 350) {
      navMoveOut = new Tween(seven_btn,"x",Bounce.easeOut,350,330,1,true);
      navMoveOut = new Tween(seven_btn,"y",Bounce.easeOut,30,20,1,true);
      seven_btn.removeEventListener(MouseEvent.CLICK, sevenMoveOut);
   }
}
function homeMoveOut(event:MouseEvent):void {
   navMoveOut = new Tween(home_btn,"x",Bounce.easeOut,50,30,1,true);
   navMoveOut = new Tween(home_btn,"y",Bounce.easeOut,30,20,1,true);
   home_btn.addEventListener(MouseEvent.CLICK, homeMove);
   home_btn.removeEventListener(MouseEvent.CLICK, homeMoveOut);
}

//////////////////////////////////////////////////////////////////// TWO MOVE //

function twoMove(event:MouseEvent):void {
   navMoveIn = new Tween(two_btn,"x",Bounce.easeOut,80,100,1,true);
   navMoveIn = new Tween(two_btn,"y",Bounce.easeOut,20,30,1,true);
   two_btn.removeEventListener(MouseEvent.CLICK, twoMove);
   two_btn.addEventListener(MouseEvent.CLICK, twoMoveOut);
   home_btn.addEventListener(MouseEvent.CLICK, homeMove);
   three_btn.addEventListener(MouseEvent.CLICK, threeMove);
   four_btn.addEventListener(MouseEvent.CLICK, fourMove);
   five_btn.addEventListener(MouseEvent.CLICK, fiveMove);
   six_btn.addEventListener(MouseEvent.CLICK, sixMove);
   seven_btn.addEventListener(MouseEvent.CLICK, sevenMove);



   if (home_btn.x == 50) {
      navMoveOut = new Tween(home_btn,"x",Bounce.easeOut,50,30,1,true);
      navMoveOut = new Tween(home_btn,"y",Bounce.easeOut,30,20,1,true);
      home_btn.removeEventListener(MouseEvent.CLICK, homeMoveOut);
   }
   if (three_btn.x == 150) {
      navMoveOut = new Tween(three_btn,"x",Bounce.easeOut,150,130,1,true);
      navMoveOut = new Tween(three_btn,"y",Bounce.easeOut,30,20,1,true);
      three_btn.removeEventListener(MouseEvent.CLICK, threeMoveOut);
   }
   if (four_btn.x == 200) {
      navMoveOut = new Tween(four_btn,"x",Bounce.easeOut,200,180,1,true);
      navMoveOut = new Tween(four_btn,"y",Bounce.easeOut,30,20,1,true);
      four_btn.removeEventListener(MouseEvent.CLICK, fourMoveOut);
   }
   if (five_btn.x == 250) {
      navMoveOut = new Tween(five_btn,"x",Bounce.easeOut,250,230,1,true);
      navMoveOut = new Tween(five_btn,"y",Bounce.easeOut,30,20,1,true);
      five_btn.removeEventListener(MouseEvent.CLICK, fiveMoveOut);
   }
   if (six_btn.x == 300) {
      navMoveOut = new Tween(six_btn,"x",Bounce.easeOut,300,280,1,true);
      navMoveOut = new Tween(six_btn,"y",Bounce.easeOut,30,20,1,true);
      six_btn.removeEventListener(MouseEvent.CLICK, sixMoveOut);
   }
   if (seven_btn.x == 350) {
      navMoveOut = new Tween(seven_btn,"x",Bounce.easeOut,350,330,1,true);
      navMoveOut = new Tween(seven_btn,"y",Bounce.easeOut,30,20,1,true);
      seven_btn.removeEventListener(MouseEvent.CLICK, sevenMoveOut);
   }
}

function twoMoveOut(event:MouseEvent):void {
   navMoveIn = new Tween(two_btn,"x",Bounce.easeOut,100,80,1,true);
   navMoveOut = new Tween(two_btn,"y",Bounce.easeOut,30,20,1,true);
   two_btn.addEventListener(MouseEvent.CLICK, twoMove);
   two_btn.removeEventListener(MouseEvent.CLICK, twoMoveOut);
}

//////////////////////////////////////////////////////////////////// THREE MOVE //

function threeMove(event:MouseEvent):void {
   navMoveIn = new Tween(three_btn,"x",Bounce.easeOut,130,150,1,true);
   navMoveIn = new Tween(three_btn,"y",Bounce.easeOut,20,30,1,true);
   three_btn.removeEventListener(MouseEvent.CLICK, threeMove);
   three_btn.addEventListener(MouseEvent.CLICK, threeMoveOut);
   home_btn.addEventListener(MouseEvent.CLICK,homeMove);
   two_btn.addEventListener(MouseEvent.CLICK, twoMove);
   four_btn.addEventListener(MouseEvent.CLICK, fourMove);
   five_btn.addEventListener(MouseEvent.CLICK, fiveMove);
   six_btn.addEventListener(MouseEvent.CLICK, sixMove);
   seven_btn.addEventListener(MouseEvent.CLICK, sevenMove);

   if (home_btn.x == 50) {
      navMoveOut = new Tween(home_btn,"x",Bounce.easeOut,50,30,1,true);
      navMoveOut = new Tween(home_btn,"y",Bounce.easeOut,30,20,1,true);
      home_btn.removeEventListener(MouseEvent.CLICK, homeMoveOut);
   }
   if (two_btn.x == 100) {
      navMoveOut = new Tween(two_btn,"x",Bounce.easeOut,100,80,1,true);
      navMoveOut = new Tween(two_btn,"y",Bounce.easeOut,30,20,1,true);
      two_btn.removeEventListener(MouseEvent.CLICK, twoMoveOut);
   }
   if (four_btn.x == 200) {
      navMoveOut = new Tween(four_btn,"x",Bounce.easeOut,200,180,1,true);
      navMoveOut = new Tween(four_btn,"y",Bounce.easeOut,30,20,1,true);
      four_btn.removeEventListener(MouseEvent.CLICK, fourMoveOut);
   }
   if (five_btn.x == 250) {
      navMoveOut = new Tween(five_btn,"x",Bounce.easeOut,250,230,1,true);
      navMoveOut = new Tween(five_btn,"y",Bounce.easeOut,30,20,1,true);
      five_btn.removeEventListener(MouseEvent.CLICK, fiveMoveOut);
   }
   if (six_btn.x == 300) {
      navMoveOut = new Tween(six_btn,"x",Bounce.easeOut,300,280,1,true);
      navMoveOut = new Tween(six_btn,"y",Bounce.easeOut,30,20,1,true);
      six_btn.removeEventListener(MouseEvent.CLICK, sixMoveOut);
   }
   if (seven_btn.x == 350) {
      navMoveOut = new Tween(seven_btn,"x",Bounce.easeOut,350,330,1,true);
      navMoveOut = new Tween(seven_btn,"y",Bounce.easeOut,30,20,1,true);
      seven_btn.removeEventListener(MouseEvent.CLICK, sevenMoveOut);
   }

}
function threeMoveOut(event:MouseEvent):void {
   navMoveOut = new Tween(three_btn,"x",Bounce.easeOut,150,130,1,true);
   navMoveOut = new Tween(three_btn,"y",Bounce.easeOut,30,20,1,true);
   three_btn.addEventListener(MouseEvent.CLICK, threeMove);
   three_btn.removeEventListener(MouseEvent.CLICK, threeMoveOut);
}

//////////////////////////////////////////////////////////////////// FOUR MOVE //

function fourMove(event:MouseEvent):void {
   navMoveIn = new Tween(four_btn,"x",Bounce.easeOut,180,200,1,true);
   navMoveIn = new Tween(four_btn,"y",Bounce.easeOut,20,30,1,true);
   four_btn.removeEventListener(MouseEvent.CLICK, fourMove);
   four_btn.addEventListener(MouseEvent.CLICK, fourMoveOut);
   home_btn.addEventListener(MouseEvent.CLICK,homeMove);
   two_btn.addEventListener(MouseEvent.CLICK, twoMove);
   three_btn.addEventListener(MouseEvent.CLICK, threeMove);
   five_btn.addEventListener(MouseEvent.CLICK, fiveMove);
   six_btn.addEventListener(MouseEvent.CLICK, sixMove);
   seven_btn.addEventListener(MouseEvent.CLICK, sevenMove);

   if (home_btn.x == 50) {
      navMoveOut = new Tween(home_btn,"x",Bounce.easeOut,50,30,1,true);
      navMoveOut = new Tween(home_btn,"y",Bounce.easeOut,30,20,1,true);
      home_btn.removeEventListener(MouseEvent.CLICK, homeMoveOut);
   }
   if (two_btn.x == 100) {
      navMoveOut = new Tween(two_btn,"x",Bounce.easeOut,100,80,1,true);
      navMoveOut = new Tween(two_btn,"y",Bounce.easeOut,30,20,1,true);
      two_btn.removeEventListener(MouseEvent.CLICK, twoMoveOut);
   }
   if (three_btn.x == 150) {
      navMoveOut = new Tween(three_btn,"x",Bounce.easeOut,150,130,1,true);
      navMoveOut = new Tween(three_btn,"y",Bounce.easeOut,30,20,1,true);
      three_btn.removeEventListener(MouseEvent.CLICK, threeMoveOut);
   }
   if (five_btn.x == 250) {
      navMoveOut = new Tween(five_btn,"x",Bounce.easeOut,250,230,1,true);
      navMoveOut = new Tween(five_btn,"y",Bounce.easeOut,30,20,1,true);
      five_btn.removeEventListener(MouseEvent.CLICK, fiveMoveOut);
   }
   if (six_btn.x == 300) {
      navMoveOut = new Tween(six_btn,"x",Bounce.easeOut,300,280,1,true);
      navMoveOut = new Tween(six_btn,"y",Bounce.easeOut,30,20,1,true);
      six_btn.removeEventListener(MouseEvent.CLICK, sixMoveOut);
   }
   if (seven_btn.x == 350) {
      navMoveOut = new Tween(seven_btn,"x",Bounce.easeOut,350,330,1,true);
      navMoveOut = new Tween(seven_btn,"y",Bounce.easeOut,30,20,1,true);
      seven_btn.removeEventListener(MouseEvent.CLICK, sevenMoveOut);
   }

}
function fourMoveOut(event:MouseEvent):void {
   navMoveOut = new Tween(four_btn,"x",Bounce.easeOut,200,180,1,true);
   navMoveOut = new Tween(four_btn,"y",Bounce.easeOut,30,20,1,true);
   four_btn.addEventListener(MouseEvent.CLICK, fourMove);
   four_btn.removeEventListener(MouseEvent.CLICK, fourMoveOut);
}

//////////////////////////////////////////////////////////////////// FIVE MOVE //

function fiveMove(event:MouseEvent):void {
   navMoveIn = new Tween(five_btn,"x",Bounce.easeOut,230,250,1,true);
   navMoveIn = new Tween(five_btn,"y",Bounce.easeOut,20,30,1,true);
   five_btn.removeEventListener(MouseEvent.CLICK, fiveMove);
   five_btn.addEventListener(MouseEvent.CLICK, fiveMoveOut);
   home_btn.addEventListener(MouseEvent.CLICK,homeMove);
   two_btn.addEventListener(MouseEvent.CLICK, twoMove);
   three_btn.addEventListener(MouseEvent.CLICK, threeMove);
   four_btn.addEventListener(MouseEvent.CLICK, fourMove);
   six_btn.addEventListener(MouseEvent.CLICK, sixMove);
   seven_btn.addEventListener(MouseEvent.CLICK, sevenMove);

   if (home_btn.x == 50) {
      navMoveOut = new Tween(home_btn,"x",Bounce.easeOut,50,30,1,true);
      navMoveOut = new Tween(home_btn,"y",Bounce.easeOut,30,20,1,true);
      home_btn.removeEventListener(MouseEvent.CLICK, homeMoveOut);
   }
   if (two_btn.x == 100) {
      navMoveOut = new Tween(two_btn,"x",Bounce.easeOut,100,80,1,true);
      navMoveOut = new Tween(two_btn,"y",Bounce.easeOut,30,20,1,true);
      two_btn.removeEventListener(MouseEvent.CLICK, twoMoveOut);
   }
   if (three_btn.x == 150) {
      navMoveOut = new Tween(three_btn,"x",Bounce.easeOut,150,130,1,true);
      navMoveOut = new Tween(three_btn,"y",Bounce.easeOut,30,20,1,true);
      three_btn.removeEventListener(MouseEvent.CLICK, threeMoveOut);
   }
   if (four_btn.x == 200) {
      navMoveOut = new Tween(four_btn,"x",Bounce.easeOut,200,180,1,true);
      navMoveOut = new Tween(four_btn,"y",Bounce.easeOut,30,20,1,true);
      four_btn.removeEventListener(MouseEvent.CLICK, fourMoveOut);
   }
   if (six_btn.x == 300) {
      navMoveOut = new Tween(six_btn,"x",Bounce.easeOut,300,280,1,true);
      navMoveOut = new Tween(six_btn,"y",Bounce.easeOut,30,20,1,true);
      six_btn.removeEventListener(MouseEvent.CLICK, sixMoveOut);
   }
   if (seven_btn.x == 350) {
      navMoveOut = new Tween(seven_btn,"x",Bounce.easeOut,350,330,1,true);
      navMoveOut = new Tween(seven_btn,"y",Bounce.easeOut,30,20,1,true);
      seven_btn.removeEventListener(MouseEvent.CLICK, sevenMoveOut);
   }

}
function fiveMoveOut(event:MouseEvent):void {
   navMoveOut = new Tween(five_btn,"x",Bounce.easeOut,250,230,1,true);
   navMoveOut = new Tween(five_btn,"y",Bounce.easeOut,30,20,1,true);
   five_btn.addEventListener(MouseEvent.CLICK, fiveMove);
   five_btn.removeEventListener(MouseEvent.CLICK, fiveMoveOut);
}

//////////////////////////////////////////////////////////////////// SIX MOVE //

function sixMove(event:MouseEvent):void {
   navMoveIn = new Tween(six_btn,"x",Bounce.easeOut,280,300,1,true);
   navMoveIn = new Tween(six_btn,"y",Bounce.easeOut,20,30,1,true);
   six_btn.removeEventListener(MouseEvent.CLICK, sixMove);
   six_btn.addEventListener(MouseEvent.CLICK, sixMoveOut);
   home_btn.addEventListener(MouseEvent.CLICK,homeMove);
   two_btn.addEventListener(MouseEvent.CLICK, twoMove);
   three_btn.addEventListener(MouseEvent.CLICK, threeMove);
   four_btn.addEventListener(MouseEvent.CLICK, fourMove);
   five_btn.addEventListener(MouseEvent.CLICK, fiveMove);
   seven_btn.addEventListener(MouseEvent.CLICK, sevenMove);

   if (home_btn.x == 50) {
      navMoveOut = new Tween(home_btn,"x",Bounce.easeOut,50,30,1,true);
      navMoveOut = new Tween(home_btn,"y",Bounce.easeOut,30,20,1,true);
      home_btn.removeEventListener(MouseEvent.CLICK, homeMoveOut);
   }
   if (two_btn.x == 100) {
      navMoveOut = new Tween(two_btn,"x",Bounce.easeOut,100,80,1,true);
      navMoveOut = new Tween(two_btn,"y",Bounce.easeOut,30,20,1,true);
      two_btn.removeEventListener(MouseEvent.CLICK, twoMoveOut);
   }
   if (three_btn.x == 150) {
      navMoveOut = new Tween(three_btn,"x",Bounce.easeOut,150,130,1,true);
      navMoveOut = new Tween(three_btn,"y",Bounce.easeOut,30,20,1,true);
      three_btn.removeEventListener(MouseEvent.CLICK, threeMoveOut);
   }
   if (four_btn.x == 200) {
      navMoveOut = new Tween(four_btn,"x",Bounce.easeOut,200,180,1,true);
      navMoveOut = new Tween(four_btn,"y",Bounce.easeOut,30,20,1,true);
      four_btn.removeEventListener(MouseEvent.CLICK, fourMoveOut);
   }
   if (five_btn.x == 250) {
      navMoveOut = new Tween(five_btn,"x",Bounce.easeOut,250,230,1,true);
      navMoveOut = new Tween(five_btn,"y",Bounce.easeOut,30,20,1,true);
      five_btn.removeEventListener(MouseEvent.CLICK, fiveMoveOut);
   }
   if (seven_btn.x == 350) {
      navMoveOut = new Tween(seven_btn,"x",Bounce.easeOut,350,330,1,true);
      navMoveOut = new Tween(seven_btn,"y",Bounce.easeOut,30,20,1,true);
      seven_btn.removeEventListener(MouseEvent.CLICK, sevenMoveOut);
   }

}
function sixMoveOut(event:MouseEvent):void {
   navMoveOut = new Tween(six_btn,"x",Bounce.easeOut,300,280,1,true);
   navMoveOut = new Tween(six_btn,"y",Bounce.easeOut,30,20,1,true);
   six_btn.addEventListener(MouseEvent.CLICK, sixMove);
   six_btn.removeEventListener(MouseEvent.CLICK, sixMoveOut);
}

//////////////////////////////////////////////////////////////////// SEVEN MOVE //

function sevenMove(event:MouseEvent):void {

   navMoveIn = new Tween(seven_btn,"x",Bounce.easeOut,330,350,1,true);
   navMoveIn = new Tween(seven_btn,"y",Bounce.easeOut,20,30,1,true);
   seven_btn.removeEventListener(MouseEvent.CLICK, sevenMove);
   seven_btn.addEventListener(MouseEvent.CLICK, sevenMoveOut);
   home_btn.addEventListener(MouseEvent.CLICK,homeMove);
   two_btn.addEventListener(MouseEvent.CLICK, twoMove);
   three_btn.addEventListener(MouseEvent.CLICK, threeMove);
   four_btn.addEventListener(MouseEvent.CLICK, fourMove);
   five_btn.addEventListener(MouseEvent.CLICK, fiveMove);
   six_btn.addEventListener(MouseEvent.CLICK, sixMove);
   seven_btn.addEventListener(MouseEvent.CLICK, sevenMove);

   if (home_btn.x == 50) {
      navMoveOut = new Tween(home_btn,"x",Bounce.easeOut,50,30,1,true);
      navMoveOut = new Tween(home_btn,"y",Bounce.easeOut,30,20,1,true);
      home_btn.removeEventListener(MouseEvent.CLICK, homeMoveOut);
   }
   if (two_btn.x == 100) {
      navMoveOut = new Tween(two_btn,"x",Bounce.easeOut,100,80,1,true);
      navMoveOut = new Tween(two_btn,"y",Bounce.easeOut,30,20,1,true);
      two_btn.removeEventListener(MouseEvent.CLICK, twoMoveOut);
   }
   if (three_btn.x == 150) {
      navMoveOut = new Tween(three_btn,"x",Bounce.easeOut,150,130,1,true);
      navMoveOut = new Tween(three_btn,"y",Bounce.easeOut,30,20,1,true);
      three_btn.removeEventListener(MouseEvent.CLICK, threeMoveOut);
   }
   if (four_btn.x == 200) {
      navMoveOut = new Tween(four_btn,"x",Bounce.easeOut,200,180,1,true);
      navMoveOut = new Tween(four_btn,"y",Bounce.easeOut,30,20,1,true);
      four_btn.removeEventListener(MouseEvent.CLICK, fourMoveOut);
   }
   if (five_btn.x == 250) {
      navMoveOut = new Tween(five_btn,"x",Bounce.easeOut,250,230,1,true);
      navMoveOut = new Tween(five_btn,"y",Bounce.easeOut,30,20,1,true);
      five_btn.removeEventListener(MouseEvent.CLICK, fiveMoveOut);
   }
   if (six_btn.x == 300) {
      navMoveOut = new Tween(six_btn,"x",Bounce.easeOut,300,280,1,true);
      navMoveOut = new Tween(six_btn,"y",Bounce.easeOut,30,20,1,true);
      six_btn.removeEventListener(MouseEvent.CLICK, sixMoveOut);
   }

}
function sevenMoveOut(event:MouseEvent):void {
   navMoveOut = new Tween(six_btn,"x",Bounce.easeOut,350,330,1,true);
   navMoveOut = new Tween(six_btn,"y",Bounce.easeOut,30,20,1,true);
   seven_btn.addEventListener(MouseEvent.CLICK, sevenMove);
   seven_btn.removeEventListener(MouseEvent.CLICK, sevenMoveOut);
}


buttonMode = true;

Rollover/off Anim Control Button, Problem Adding Button Functionality
Hi, I'm really new to flash, so forgive me for sounding like an simpleton.

I'm trying to create a button that when you roll over, it grows in size and some text animates onto it. When you roll off, the anim is supposed to reverse and go back to the rest state. I've managed to get the animation to work okay, so it grows and shrinks accordinly. My problem now is, I want to make this into a functional button, ie to add a mailto: link, or a link to another frame.

Whats the best way to achieve this? I've tried to convert to a button and have the anim in all button states, but this didn't work. And a get an error when trying to add the mailto action script to the button, saying 'on release' should only be used on instanced buttons. I tried making an invisible button behind the animated on, but I loose the animation playback when rolling over the invisible button. It seems I can't do both for some reason.

I'm using this script on the first frame to control the playback of the movie. And stop on the last frame.


stop();
this.onRollOver = function() {
rewind = false;
this.play();
};
this.onRollOut = function() {
rewind = true;
};
this.onEnterFrame = function() {
if (rewind == true) {
prevFrame();
}
};

Any help would be appreciated, I've tried so many times with different approaches to no avail.

Using The Slider Menu With The Zoom Effect Functionality
This is what I would like to get accomplished. To complete my Gallery page, I would like to use the Slider menu effect to display various items on stage. Once an item is selected, it will load the Zoom effect in the center of the Gallery, which will display a close up view of the item with the Zoom functionality. My problem is that once the Zoom SWF is loaded, the functionality doesn’t work. I can drag the object around but the objects zoom features are disabled for some reason. Is this a common problem when SWFs are loaded within other SWFs? Or is it just me! Attached are my files that work perfectly fine alone but when incorporated together I get a completely different effect.

Note: The Mymenu2 file only uses the first box to the far left as a button which loads the zoom effect.

Adjusting Simple Button .y Losing Button Functionality
I'm trying to dynamically move a "more info" button right under a block of text based on the height of the text. The problem is when I move the button in code, the button is no longer clickable(??). I'm using the CS3 IDE and creating a simpleButton. simpleButton is supposed to inherit the displayObject class so I don't understand why this is happening. If I trace out the button reference, it traces [object SimpleButton]. I have a textfield named 'txt' and button named 'btn' on the stage.


Code:
btn.y = txt.y + txt.textHeight + 10

Help With Button Functionality
Hello AS Guru's,

I've been knocking my head against the desk trying to get this right and it sure seemed simple at the time. Here's what I'm trying to do:

-I have a 5 page website
- Home
- Products
- Support
- Downloads
- Contact Us

When a visitor clicks on the "Contact Us" button, they are sent to that page accordingly.

The problem is this...I created a "Thank you" page not related to any of the menu buttons but will appear once the "Submit" button is pressed on the "Contact Us" page.

The "Submit" button won't work and when I did get it working, the other buttons on the menu stopped working. I know I'm close, just got stuck. Here's the code:


Code:
Home_btn.onRelease = function(){
_root.box.gotoAndPlay(2);
_root.targetx = _root.Home_btn._x;
_root.gotoAndStop("Home");
}
Products_btn.onRelease = function(){
_root.box.gotoAndPlay(2);
_root.targetx = _root.Products_btn._x;
_root.gotoAndStop("Products");
}
Support_btn.onRelease = function(){
_root.box.gotoAndPlay(2);
_root.targetx = _root.Support_btn._x;
_root.gotoAndStop("Support");
}
Downloads_btn.onRelease = function(){
_root.box.gotoAndPlay(2);
_root.targetx = _root.Downloads_btn._x;
_root.gotoAndStop("Downloads");
}
ContactUs_btn.onRelease = function(){
_root.box.gotoAndPlay(2);
_root.targetx = _root.ContactUs_btn._x;
_root.gotoAndStop("ContactUs");
FirstName = "";
LastName = "";
Email = "";
Feedback = "";
}
Submit_btn.onRelease = function() {
_root.box.gotoAndPlay(2);
_root.targetx = _root.ContactUs_btn._x;
_root.gotoAndStop("Thankyou");
subject = "Feed Back Form";
recipient = "xxxxxxxx@bellsouth.net";
loadVariablesNum ("http://www.xxxxxxxx.com/cgi-bin/formmail.pl", 0, "GET");
gotoAndStop ("ThankYou");
}
stop();
I'm wanting the "Thank you" page to appear and when the visitor clicks on any button, they go to their destination accordingly (i.e. Home, Products, Support, etc). For some reason, the "Submit" button no longer works...the "Reset" button still works.

Now, I placed the Reset button AS on the Reset button itself...


Code:
on (Release) {
FirstName = "";
LastName = "";
Email = "";
Feedback = "";
}
Frankly, I'm just tired of looking at it. Any help would be greatly appreciated and I look forward to your response(s).

Thanks,

Getnoldfast

Button Functionality
got a loop that adds button functionality to 6 buttons. At first all button have the alpha value of 100%. what I want to happen is once you roll over one, all others fade out. then when you roll off if fade out to the alpha value of the other.

Currently I have it when you rollover one it fades out and when you roll off it fade back in.

this is the code I am using right now.

ActionScript Code:
for (var i:Number = 1; i<=6; i++) {
        var thumb:MovieClip = attachMovie("hero"+i, "myHero"+i, this.getNextHighestDepth());
        thumb._x = xPos;
        thumb._y = yPos;
        thumb._alpha = 100;
        xPos += thumb._width+10;
        if (xPos>550) {
            xPos = 259;
            yPos += thumb._height+10;
        }
        trace(thumb);
        thumb.iVar = i;
        thumb.pic = picArray[i-1];
        thumb.bar = barArray[i-1];
        thumb.onRollOver = function() {
            this.onEnterFrame = function() {
                if (this._alpha>40) {
                    this._alpha -= s;
                } else {
                    delete this.onEnterFrame;
                }
            };
        };
        thumb.onRollOut = function() {
            this.onEnterFrame = function() {
                if (this._alpha<100) {
                    this._alpha += s;
                } else {
                    delete this.onEnterFrame;
                }
            };
        };
    }

Button Functionality Question
greetings,
this is probably an easy scripting question, but i do not know how to go about it. basically, i want to have buttons where it will reveal an area in the exact same way that the menus inside of flash work, with the arrow beside the button name pointing to the right when the option is off, and down when the option is on and the table/mc/text field, etc is visible/open. same kind of button style as itunes as well. can anyone point me in the right direction to do this?

No Button Functionality In Fullscreen
Publishing a flash app that is fullscreen.

The problem is, when I run the .exe, the app plays fine (goes through intro etc), but none of the buttons are clickable.

The little hand icon doesn't appear either.

The problem is solved when I push "ESC" and it gets out of fullscreen mode..

any ideas?

EDIT: At first I thought it was something to do with some code I put in, but I tried exporting an older version of the file without editing it, and it did the same thing. And the older version used to export fine... So it must be something happening when I publish the movie.

Button Functionality On Movieclips
i have this code on a frame:

function moveClip3() {
if (myClip3_mc._x < 1200) {
myClip3_mc._x += 0.5; // move the clip 1 px to the right
} else {
myClip3_mc._x = -150;
}
}
myInterval = setInterval(moveClip3, 5);

i have 2 other clips that move with this one. i would like to pause all clips when i put my mouse over any of the clips. can anyone show mehow to do that? i have searched all day for tutes on this but nothing. i dont think i need to place individ scripts as buttons on the clips (make them buttons and then...)

what is the best way of doing this?

XML Dependent Button Functionality
So I want to use this very simple XML file and use it to create some buttons and their labels. I want each button to have the same functionality, that when you click it, a dynamic text box is populated with the label of the button.

Catch is, I need the button components to be pulled dynamically with actionscript, so no instances of the button component can be on the stage.

Right now when I click any of the buttons it populates with option 4.

Banging my head on the desk with this one, any help/advice is appreciated.

Here's the code:

XML file
<?xml version="1.0"?>
<menu name="example">
<DBbutton name="option 1" />
<DBbutton name="option 2"/>
<DBbutton name="option 3"/>
<DBbutton name="option 4"/>
</menu>

actionscript (only thing on the stage is a dynamic text box called options box, and "Button" is the name of the component button in the library)

loadButtons = function(container, name, depth, node_xml) {

var curr_node;
var curr_item;
var curr_menu = container.createEmptyMovieClip(name, depth)

for (var i=0; i<node_xml.childNodes.length; i++) {

curr_item = curr_menu.attachMovie("Button","item"+i+"_mc", depth+i);
curr_node = node_xml.childNodes[i];
curr_item.label= curr_node.attributes.name;
curr_item._y = i*40;

// set behavoir for each button
var button_listener = new Object();
button_listener.click = function(evtObj:Object){
optionsBox.text = curr_item.label;
};
curr_item.addEventListener("click", button_listener);

curr_item.setSize(300,24);
} // end loop
}//end loadButtons


menu_xml = new XML();
menu_xml.load("options.xml");
menu_xml.ignoreWhite= true;
menu_xml.onLoad = function(ok) {
loadButtons(_root,"mainmenu_mc", 1, menu_xml.firstChild);
}

stop();

Add BookMark Functionality To Button
I wish to add actionscript that will bookmark a page in Both IE and FIREFOX.
Anyone know code that will do both?

I have seen the IE tutorial, and that code looks like this:
Code:
on (release) {
getURL("javascript:window.external.AddFavorite(location.href, document.title);");
}
Thank you, any help is greatly appreciated.

A Movie W/ Button Functionality
Hi All,

I'm trying to have my cake and eat it too.

I've created a movie that I want to dynamically load .jpg files. I've then changed the property of the movie to a button so that it will have mouse click functionality.

I can have a movie that acts like a button until I put in the "loadMovie" code. Then I lose button funtionality but my external .jpg loads. If I comment out the loadMovie code, the movie acts like a button again but, of course, I can no longer load an external graphic.

Is there a way around this?

Thanks.

A Fix For MP3 Player Button Functionality
Now I found a problem with the code from Lees MP3 Tutorial and maybe this will be covered in part 3.

If you have a play button, next button and stop button, the code works correctly. The isssue is when you are: playing a song, then you press pause, then you press play: everything is still fine, now press stop, and now press play again. What happens is now the stop button acts just like the pause button. This only happens after a song has been playing then paused, then played, then stopped, then played. I fixed the issue and hopefully this helps some people out. I just made the stop function:
I know that might have been confusing but it is something that could be easily overlooked in regards to functionality. The stop button works just fine as long as the pause button has not been pressed before it.
Code:

function stopIt () : Void {
    s.position = 0;
    pos = 0;
    s.stop ();
}

What was added is the "pos = 0;" line. If you are working on the mp3 player tutorial, test your player with the scenario described above and you will see what I mean. Hope that helps some of you.

Button Functionality Using Loops
i have a bunch of buttons and instead of telling each instance to do something, i want to do it in a loop. this test function only has 3 buttons, but in actuality i have much much more.

using this function, the buttons don't seem to even work.

Code:


test();
function test() {
var button = Array("button1", "button2", "button3");
for (var i = 0; i<=2; i++) {
_root.button[i].onRelease = function() {
trace(button[i]);
};
}
}



and in this function, it keeps on displaying 4

Code:


test();
function test() {
for (var i = 1; i<=3; i++) {
_root["button"+i].onRelease = function() {
trace(i);
};
}
}



i know i'm missing something as far as buttons go, but what, i have no idea. is there another way to go about this?

Right-mouse Button Functionality Question
Hello folks,

We are looking for a solution. We are developing web-based training in Flash 5. The training is for software simulation. One of the tasks the user must do is to right-mouse click on the screen, which brings up a drop-down menu. Our instructional designers insist they must have this functionality.

Our problem is that in the Flash 5 player, (running Internet Explorer 5.0 on PCs), we know of no way to detect the right-mouse click.

Any ideas? What do you suggest?

Thanks,

Greg Miller
getsmall@shrinkray.com

Back Button Functionality In A Form
Hi there - I've built a form in MX using components that works fine (Submits to a db etc), but I've been asked to include a back button. Using the Help system, I've managed to get the text boxes to retain their data, but I can't transfer the data from my collective data object (Called Entry) back to the drop downs nor checkboxes. I've followed the help files to the letter, but it doesn't work. Any ideas?

thanks!

frank

Please HELP With Building Back-button Functionality
Hi All!

I may sound lost, but I really can't find a simple way to build a back-button to keep a history of the user's navigation within a flash movie. Is there a simple way to do this; i.e. allow the user to trace back their navigation? Since there are quite a few number of movies inside the movies, how can I keep a record of which movie and frame they visited prior to moving from a link for example.

Any help is VERY appreciated. Thanks for all the suggestions in advance.

Preloader Interfering With Button Functionality
I am having a problem when I add a preloader to a swf that loads on top of the my main swf. When I don't have the preloader in the movie that loads on level 1, the buttons work fine. When I add the preloader, the button functionality is lost. The real problem with the way it works now, is the user has no idea that the movie is being loaded and it may be frustrating for them. I have no idea and if someone has a clue why, I would really appreciate the help. Thx!!

The code I have used to load the swf on top of the main swf is

on (release) {
loadMovie("flashnav_clientresults.swf", 1);
}

An example on the web of the way it works currently with no preloader, but functioning buttons is located at http://www.shr.com/fairmont.html

An example of the way I would like it to work with the preloader, but no button functionality is located at http://www.shr.com/fairmont_pl.html

I have uploaded the FLAs of both versions to
http://www.shr.com/ClientMenu.zip
(size is 392kb for the zipped folder)

Play/Pause Button Functionality
I created a presentation with multiple movie clips scattered throughout along with a streaming voiceover tracks. Is there an easier way to stop/play the movie through my pause/play button rather than targeting every movie clip in my presentation? Something like the control of global playback no matter what movie clip/clips are playing at the moment the button is pressed?

Thanks.

Change Button Functionality From A Different Movie
ok, here is what I want to do. I have the concept in my head, I just can't seem to get it to work.

I have a "forward" button in a movie on level 100. I need it to control whatever movie is on level 10. I need to put a code on the first frame of each of those movies being played on level 10 to change the buttons functionality so it will move to where it needs to when the "forward" button is clicked.

I believe I need to use variables some how but mine don't seem to work. Can someone give me a working example?

[CS3] Please Help Me With Fade Transition And Button Functionality
Can some please tell me how to make a page transition whereby the screen fades into black and the desired page fades in (hope my explanation is clear!):

http://www.lotusgraphicdesign.net/small.html

I'd prefer if only necessary pieces faded (e.g. the lilypads and button wouldn't fade when going from Home to Lotus as there is no need, but the Lotus Graphic Design logo would fade out as it isn't on the Lotus page).

I tried breaking each page into individual scenes in which I created a layer with a black rectangle that covers the entire document and converted it into a graphic with varying alpha settings but I find that I can't get the buttons to go where I want them to:

http://www.lotusgraphicdesign.net/Lo...phicDesign.swf (I only have a Home, Lotus and Portfolio scene so far, many apologies for how incomplete this is!)

This problem has been really bugging me for a while now!

I can't attach either .fla as they're too big, though maybe I could email them to anyone willing to have a look?

Any help is appreciated,

Niall

Button Functionality Lost In Converting To AS2
I have a series of buttons, grouped within a parent Movie clip. Each individual button has a MC of its own, and the button sits inside that second MC. The event handlers are attached to each button.

Since converting the code to Player 7/AS2 I have lost the button functionalityand can't seem to figure out why.

Any suggestions?

Preloader Interfering With Button Functionality
I am having a problem when I add a preloader to a swf that loads on top of the my main swf. When I don't have the preloader in the movie that loads on level 1, the buttons work fine. When I add the preloader, the button functionality is lost. The real problem with the way it works now, is the user has no idea that the movie is being loaded and it may be frustrating for them.

I have no idea and if someone is nice enough to try, I would really appreciate the help. Thx!!

The code I have used to load the swf on top of the main swf is

on (release) {
loadMovie("flashnav_clientresults.swf", 1);
}

An example on the web of the way it works currently with no preloader, but functioning buttons is located at http://www.shr.com/fairmont.html

An example of the way I would like it to work with the preloader, but no button functionality is located at http://www.shr.com/fairmont_pl.html

I have uploaded the FLAs of both versions to
http://www.shr.com/ClientMenu.zip
(size is 392kb for the zipped folder)

Back Button Functionality Wih Flash
I am interested in how to use the back button on popular browsers (ie, firefox, mac) with my flash websites.
Upon many searches, it seems that many work arounds utilize javascript.
  But I have found many of the articles out of date.  I would appreciate any links or software that you have found that might represent the best way to utilize my flash sites with the back button.
'
thanks in advance.

Jonathan

Back Button Functionality W/o Frames
I'm about to work on getting the back button to work with a flash site I've done and I wanted to know if people have seen a method that doesn't use frames.

It doesn't make sense that it would be possible but I thought I should ask.

I've worked with the Flash/Javascript Integration kit and it's beautiful. Not sure if some solution existed there that would keep my XHTML compliant code uncluttered and frame free...

The back button is much more important though...thanks for all your input!

Button Functionality Lost When This Code Added...
code: onClipEvent (mouseMove) {
startDrag (this, true, 0, 0, 145.8, 47);
}

to an eyeball that is supposed to follow the mouse around.

Any ideas why?

Why Button Functionality Goes Away When Startdrag Action Is Applied?
I don't understand why my button functionality goes away when I apply this code to the MC???

on (press) {
startDrag(this, false, 240, 161, 460, 161);
}
on (release) {
stopDrag();
}

All I am trying to do is to make a MC (made up of buttons) scroll from left to right within a mask. Everything works fine until I apply the on (press) startdrag code.

I am new at this so if there is a better way...

Thanks to all...

Here is the .fla if it would be helpful...

[F8] How To Hide Button Functionality On Different Page Depths
Hi, I had some very helpful advice the other day so thought I would do another post in the hope of more super advice.

I am swapping the depths of pages in flash, the problem I have is that even though you cannot see the buttons on the lower pages if you move the mouse over their position on the top page the cursor changes and you can still click them. How do I prevent this happening?

Help with this will be greatly appreciated (again)

Movie Loading Layers / Button Functionality
how do you get buttons to lose their functionality once a new movie is loaded? I'm having trouble, I have a movieclip (with buttons) and when pressed, and new movie loads over the top of them - but the buttons in the movie underneath still have their functionality - how do i remove this so that only the top (visible layer) retains functionality?

any help appreciated :]

Add Button Functionality To Kirupa XML Slide Show?
I am making a more complex version of the slide show that Kirupa created here:
http://www.kirupa.com/developer/mx20..._slideshow.htm

How can I add functionality so that when I create (for instance) a button for slide 3 "button_3", it takes you directly to slide 3, pulling the correct XML information?

[MX04] Movie Clip Button + Increased Functionality.
Hello,

I have a mc button that i would like to;

on click 1, play button animation & plays another mc.

on click 2, plays another internal animation...basically an arrow that rotates left and right, and the same other mc, in another direction.

I'm VERY new to actionscripting, but i have managed the mc button with a rollover and rolloff animations.

I have a feeling it may be some kind of 'if' variable, that when the playhead in the movie clip is at a certain point, a certain action happens etc... But I'm not sure how to handle that.

Thanks in advance

Attention Adobe: Button Functionality Affected By ComboBox
Normal buttons (my own or from the included Library) misbehave when a standard flash comboBox component and associated Event Listener for detecting selections in the comboBox is added. The buttons work, but once you've used the comboBox either selecting or just expanding its options flash doesn't register any mouse click within the same pixel space for any buttons for the duration of your flash movie, if I move my mouse a pixel off the last button's click location it then works - what up with that????

Yeah normally people would click for example a 'Next' button to go to the next page and do stuff then navigate back to the next button and it would work, but if someone say uses a comboBox for navigation then clicks 'Next' and then another 'Next' button to skip through a sites content you'd expect the button to work regardless of if the mouse cursor has moved from its last known location or not.

This is a BUG - Adobe please fix!

Infinite Loop Menu
I know I've seen this one done before using 2 movieclips side by side that contain all your buttons and you basically change the _x value of the grouped buttons based where its _x value to make it look like the buttons are looping.

What I want to do is break it apart a bit and try to do this for individual button movie clips.

Basically I have a LEFT and RIGHT scroll arrow button(s) that calls a shiftX function and feeds it a 1 or -1 value based on which button is pressed. That is how I change the direction.

Inside the shiftX function I have a for loop that tells all the buttons to slide left or right based on a predetermined "shiftVar:Number" that I have set up. I multiply that number by my dir variable to get the direction the buttons need to move.

The problem I'm running into when I hit the LEFT/RIGHT arrows multiple times is my buttons kind of get all misaligned (because everytime I call the function its basing the final destination on the current X value the button(s) are at. Its fine if I just hit the arrow buttons once (and let the animation run and then stop).

Does any of this make sense?

Dynamic Menu With Array And Loop
hi, i am trying to create a dynamic menu. i have used an array for the data and then used a loop to create the menu. i am now trying to add funcionality to the menu so that when a button is released...it will load another movie, etc. also...two of the buttons need to have drop downs...i created those using an array/loop as well but i can't figure out how to have it appear only when the button is rolled over. here is my code so far...any help or recommendations for other tutorials would be appreciated. thanks!









Attach Code

this.attachMovie("bkgrnd", "background", this.getNextHighestDepth());


var xPos = 10;
var yPos = 40;


var menuDepth:Array = new Array();
var metainfo:Array = new Array();
/
metainfo[0] = new Object();
metainfo[0].title = "button1";
metainfo[0].section = "button1";
metainfo[0].view = "button1";
metainfo[0].link = "/button1.html";
metainfo[0].data = new Array();
metainfo[0].data[0] = { title: "subnava", view: "subnava", subview: null, data: null, link:"/subnava.html" };
metainfo[0].data[1] = { title: "subnavb", view: "subnavb", subview: null, data: null, link:"/subnab.html" };
metainfo[0].data[2] = { title: "subnavc", view: "subnavc", subview: null, data: null, link:"/subnavc.html" };

metainfo[1] = new Object();
metainfo[1].title = "button2";
metainfo[1].section = "button2";
metainfo[1].view = "button2";
metainfo[1].link = "/button2.html";
metainfo[1].data = null;

metainfo[2] = new Object();
metainfo[2].title = "button3";
metainfo[2].section = "button3";
metainfo[2].view = "button3";
metainfo[2].link = "/button3.html";
metainfo[2].data = new Array();
metainfo[2].data[0] = { title: "subnava", view: "subnava", subview: null, data: null };

metainfo[3] = new Object();
metainfo[3].title = "button4";
metainfo[3].section = "button4";
metainfo[3].view = "button4";
metainfo[3].link = "/button4.html";
metainfo[3].data = null;


for (i=0; i<metainfo.length; i++) {
attachMovie("container", "nav"+i, menuDepth.push(this), {_x:xPos});
xPos += this["nav"+i]._width - 25;
this["nav"+i].label_txt.text = metainfo[i].title;
this["nav"+i].url_btn._url = metainfo[i].link;
this["nav"+i].view = metainfo[i].view;




if (metainfo[i].data!=null) {
for (j=0; j<metainfo[i].data.length; j++) {
attachMovie("subContainer", "subNav"+j, menuDepth.push(this), {_y:yPos});
yPos += this["subNav"+j]._height;
this["subNav"+j].subLabel_txt.text = metainfo[i].data[j].title;
this["subNav"+j].subUrl_btn._url = metainfo[i].data[j].link;
this["subNav"+j].view = metainfo[i].data[j].view;

}

}




}

Infinite Menu Doesn´t Loop
:- I´m trying to make the inf. menu tutorial , it seems quite simple, but when i copy and paste the final code so it can make the loop.... it doesnt. I can´t figure it out why.
Here is the .fla file .
thanks...
A.

Horizontal Menu Made With For Loop
Hello,
So My problem is I can't seem to get my horizontal nav to space out with an even number of space between the items.
any help would be very very much appreciated. I also attached the source files. Thanks.

Mike

Code:

package {

   import flash.display.*;
   import flash.events.*;
   import caurina.transitions.*;
   import flash.text.TextField;
   import flash.net.*;



   public class Nav extends MovieClip {
      private const BTN_X:Number=0;
      private const BTN_Y:Number=0;
      private const SPACE:Number=40;


      private var ButtonName:Array=new Array("home","incredible people","tell us your story","play games","featured recipes","incredible tips","ads");
      private var Pages:Array=new Array("pageHome","pageIncredible","pageTell","pageGames","pageRecipes","pageTips","pageAds");
      
      
      private var numOfButtons:Number;

      public function Nav() {

         init();
      }

      private function init():void {

         numOfButtons=ButtonName.length;
         
         for (var i:int; i < numOfButtons; i++) {
            var but=this.addChild(new NavButton());
            but.name="but" + i;
            but.theWord.text=ButtonName[i];
            but.theWord.autoSize="left";
            
            but.hit.width = but.width;
            
            //---this is the formula I thought might work in spacing it out but I'm terrible at math..
            but.x= SPACE + (but.width)*i;
            but.y=BTN_Y;
            
            but.addEventListener(MouseEvent.CLICK,onClick);
            but.buttonMode = true;
            
         trace("Name of button   "  + but.name + "  " +  but.x + "   " + but.width);

   
         }
         
      }
      
      
      private function onClick(e:MouseEvent):void {

         var buttonClicked:String=e.currentTarget.name;
         var splitName:Array=buttonClicked.split("t");
         var btnNumber:Number=splitName[1];

         trace(Pages[btnNumber]);
         dispatchEvent(new Event(Pages[btnNumber],true,false));

      }
   }
}

XML Menu Loop / Event Handler Confusion
Hi

this one is doing my head in, it's probably a real basic one for you guys but I've been scouring the net last 2 days banging my head trying to find a solution.

I'm pulling in data from an external XML file e.g.:

<resources>
<resource>
<siteName>This Site</siteName>
<siteThumb>img/img1.png</siteThumb>
<url>http://www.yahoo.com</url>
</resource>
<resource>
<siteName>That Site</siteName>
<siteThumb>img/img2.png</siteThumb>
<url>http://www.google.com</url>
</resource>
</resources>

No problem there that's all loading in fine. I have a movie clip (linkBox) in my library linked with class LinkBox, inside the movie clip there is a textfield called dataBox. I'm using:


ActionScript Code:
function ParseResources(resourceInput:XML):void{
   
    var resourceChildren:XMLList = resourceInput.resource;
   
    for (var i:int = 0; i < resourceChildren.length(); i++) {
      var linkBox:LinkBox = new LinkBox();
        linkBox.x = 10;
        linkBox.y = i * 20;
        linkBox.dataBox.text = resourceChildren[i].siteName;
      addChild(linkBox);
        linkBox.addEventListener(MouseEvent.CLICK,getSite);
    }
}

Which is all fine and groovy I end up with a batch of movie clips all lined up containing the relevant link text.

The problem arises when I'm trying to get them to link to what they are supposed to link to (which is in linkBox.dataBox.text = resourceChildren[i].url; or url in the XML file).


ActionScript Code:
function getSite(event:Event):void
{
//BIG FAT VACANT STARE
        var siteLink:URLRequest = new URLRequest(?????);
        navigateToURL(siteLink);
}

With my currently limited development knowledge I'm outside of the original loop so whatever goes in that loop is no longer relevant within this new event handler. I've tried every way I can think of to try to target one of the movie clips in my stack. I've tried sticking the instances in an array and referencing them but the array thing doesn't like being inside an XML function apparently (or I'm doing it wrong). Anyway I won't bore you with what hasn't worked, if anyone has got a solution as to how one would go about setting the getSite handler set up to do what I'm trying to get it to do I would be very grateful.

Thanks for reading.

Edward.

Xml Menu: Onrollover Declared In Loop Not Working
Can somebody please help me with the following 'cause I'm confuesd, or overlooking something completely...

I'm building a small XML menu where I want to call a function for each subitem's onrollover

part of my code:


ActionScript Code:
//*** build submenu items ****for (j=0; j< numSubItems; j++){  curSubItemName = my_XML.firstChild.childNodes[i].childNodes[j].firstChild.nodeValue;  curSubItem = _root["item"+i].createEmptyMovieClip("subItem_"+i+"_"+j, myDepth);  curSubItem._y = (j+1)*-spacing;  myDepth++;  curSubItem.onRollOver = function(){    this.subHighLight();  }}

and the subHighLight function for now just looks like this:

ActionScript Code:
MovieClip.prototype.subHighLight = function(){  trace("test");};


The menu gets populated from the XML file, no problem. However, the onRollOver simply isn't working, but why???

Thanks.

Loop & Slide Menu With Centered Result. Please Help
I'm trying to make a slide menu that, when the buttons are released (mc's in this case), the menu centers the chosen movie/image, smoothly, and allows further actions (like scale or loadMovie...).

I found several solutions for the slide and the loop. However can't seem to find the rest nor be able to solve this. Any help would be highly appreciated.

I attach the FLA with what I've got so far.

Thanks again for your time

Xml Menu: Onrollover Declared In Loop Not Working
Can somebody please help me with the following 'cause I'm confuesd, or overlooking something completely...

I'm building a small XML menu where I want to call a function for each subitem's onrollover

part of my code:


ActionScript Code:
//*** build submenu items ****for (j=0; j< numSubItems; j++){  curSubItemName = my_XML.firstChild.childNodes[i].childNodes[j].firstChild.nodeValue;  curSubItem = _root["item"+i].createEmptyMovieClip("subItem_"+i+"_"+j, myDepth);  curSubItem._y = (j+1)*-spacing;  myDepth++;  curSubItem.onRollOver = function(){    this.subHighLight();  }}

and the subHighLight function for now just looks like this:

ActionScript Code:
MovieClip.prototype.subHighLight = function(){  trace("test");};


The menu gets populated from the XML file, no problem. However, the onRollOver simply isn't working, but why???

Thanks.

For Loop In A Button
i have 9 instances of a clip on stage named S1-S9
the clip has a tween. i named some frames "break" and "restore" and put in stops.

i put a single invisible button over all the clips with this code:

on(rollOver){
for(i=1;i<10;i++){
_root.me="S"+i;
_root.me.gotoAndPlay("break");
}
}

on(rollOut){
for(j=1;j<10;j++){
me="S"+j;
me.gotoAndPlay("restore");
}
}

why doesn't this work. i attached the file.

Button Loop
Hello :)

I need to try to get this code into a loop, I have six instances of a movieclip ("item" + i) with numerically ordered names which I am assigning functions for onRollOver, on RollOut etc. I would just like to have one FOR loop, instead of repeating the code numerous times and adding the eventListeners... if possible with an incremented ("angle" + i) value...

I could do this in AS2, but with CS3 I have no idea... Please can anyone help me??

Thanks in Advance
Martin







Attach Code

function mover1(event:Event) {
event.target.x = centerX + Math.cos(angle1) * radius;
event.target.y = centerY + Math.sin(angle1) * radius;
angle1 += speed;
}
function itemOver1(event:MouseEvent):void {
event.target.image1.scaleX = 1.5;
event.target.image1.scaleY = 1.5;
speed = .005;
}
function itemOut1(event:MouseEvent):void {
event.target.image1.scaleX = 1.0;
event.target.image1.scaleY = 1.0;
speed = .05;
}
item1.addEventListener(Event.ENTER_FRAME, mover1);
item1.addEventListener(MouseEvent.ROLL_OUT, itemOut1);
item1.addEventListener(MouseEvent.ROLL_OVER, itemOver1);
item1.buttonMode = true;

Rotating Menu/ How To Prevent Button Sound When Button Is Under Another Layer
I have a rotating menu on my site. The menu buttons have a sound effect when they are rolled over.. I have a layer overtop of the rotating menu, but the buttons still rollover (and that sets off the sound effect.) when they are hidden by the top layer. How can I prevent this? It there any _x _y actionscripting that I can do to prevent this?

Here is the site if you want to see what I'm talking about:

http://www.webraptor.com/index2.html


Thanks,

-- Jeff

Can I Loop Inside A Button?
i'm wondering if i can write a loop inside a button to check the state of a variable before executing another action.

e.g. (in english rather than code, which i don't know):

on(release){

_root.short_movie.play("start");

//loop
if the movie is still playing do nothing
if the movie is finished: gotoAndStop("myLabel");
//loop end

}

if this is poss, could somebody show me the syntax for a 'while loop' please?

* 'short_movie' would have a variable 'finished' set to true at end frame *

thanks!

Loop Button Disable
Need some help please:

Depending on what number is chosen I am trying to disable a certain amount of buttons in a row of 20 different buttons called b1, b2, b3 etc.

So the user chooses a number from dropdown(dd_questions) and I have this code:

j = dd_questions.getValue();
jj = j+1;
while (jj <= 20){
set(but, "b" + jj);
but.enabled = false;
jj = jj+1;
}

If a user chooses 4, then buttons b5,b6,b7....b20 should become disabled. It just won't do it though. Any ideas?

Button Script In A For Loop
I'm trying to turn the following frame script into a loop somehow, to save some typing/space...


Code:
btn1.onRelease = function() {
loadAudioFile("../flash/clip1.swf");
};

btn2.onRelease = function() {
loadAudioFile("../flash/clip2.swf");
};

btn3.onRelease = function() {
loadAudioFile("../flash/clip3.swf");
};

btn4.onRelease = function() {
loadAudioFile("../flash/clip4.swf");
};

btn5.onRelease = function() {
loadAudioFile("../flash/clip5.swf");
};

btn6.onRelease = function() {
loadAudioFile("../flash/clip6.swf");
};
I've tried this, but it doesn't seem to work:


Code:
for (i=1; i <= 6; i++) {
["btn"+i].onRelease = function() {
loadAudioFile("../flash/clip" + [i] + ".swf");
};
}
Any help?

Thanks

Foochuck

Loop Movie Button
Hi there, here's what i'm looking for:

The code behind a button that when pressed, the current movie will jump to a SCENE that is the identical movie (except this one has a different song playing), but will pick up exactly at the same frame that was left on the previous movie/scene by the user. Thusly, it'll appear that the animation hasn't been touched, but the music has changed.

Is this possible?

Copyright © 2005-08 www.BigResource.com, All rights reserved