Assigning Same Action To All Instances Of A Button?
Hi.
I have two buttons used extensively throughout my project. The actions for the buttons always stay the same.
Button 'a' will always be:
Code:
on(release)
{
prevFrame();
}
Button 'b' will always be:
Code:
on(release)
{
nextFrame();
}
Without assigning these same actions to every single instance of the button, is there any way to assign an 'on release' action for every instance of a button to do the same throughout the movie? Just saves me repetition of code.....and time....
Thanks.
FlashKit > Flash Help > Flash ActionScript
Posted on: 07-09-2008, 03:16 PM
View Complete Forum Thread with Replies
Sponsored Links:
Assigning Event Handler Code To Button Instances
Hi
I'm trying to assign separate code to each instance of a button that I am attaching to a movie.
I'm going along the lines of:
code:
largeimgurl = "photos/large" + thumbfilename[i];
hots = "hotspot" + thumbnumber;
this["thumbnailholder" + thumbnumber].attachMovie("hotspot",hots,this["thumbnailholder" + thumbnumber].getNextHighestDepth()); //attach button
this["thumbnailholder" + thumbnumber][hots].onRelease = function()
{
_root.mainImage.loadMovie(largeimgurl);
}
The above code is in a loop. However, it doesn't seem to be working - e.g. when I test the movie the same image loads in mainImage no matter what button I click. Thanks for your help.
View Replies !
View Related
Assigning Action Script To Button Symbol
Hi, I've a problem assigning action scripts to buttons... can anyone help?
I did the following...
1) Insert >> New Symbol
2) Gave a name to this symbol, clicked on "button" for behavior and then clicked "OK"
3) In the symbol editing mode, I drew a button.
4) I then selected and grouped the button.
5) I then selected the button using the selection tool.
6) Then, I clicked on Windows >> Action to bring up the Object Action dialog box.
7) I clicked on "+" and tried to assign an action script to my button.
8) However, the actions were all greyed out.... and thus, I can't assign any actions to my button at all??
I'm aware that I could have dragged the button onto the stage and assign the action script to an instance of the button... however, what I realy want is to assign the action script to the button symbol... so that each instance that i drag onto the stage will exhibit the same behavoir (as defined by the action scipt)..
Can any kind souls give me any advise on this?? Thanxs a great deal
View Replies !
View Related
[MX] Attaching Button, Assigning Action Dynamically
Greetings! I've done all the complicated bits and now a (seemingly) simple thing is driving me round the bend. I'm loading some variables from PHP to create a menu of buttons. I get my menu items from PHP, I make a loop to iterate through the menu items, I create textFields to serve as labels, and on top of them I use attachMovie to stick instances of my little invisible button. That all works fine.
Now. How do I make them do anything?
Ideally, it seems there ought to be something like:
button_instance.onRelease = gotoAndStop("scene",2);
You know? Or:
with(button_instance) {
on(release) {
gotoAndStop("scene",2);
}
}
Something like that? See what I'm saying? The buttons don't reside in a "physical" movie clip where I can assign button actions in the normal way, they're just attached on the fly. There's gotta be a way to make them dance.
Right?
View Replies !
View Related
Making Button Instances In An Action Script Menu
Hiya,
im using Flash MX, and im rather new to it. I d/l'd a sample menu here and wanted to edit it for my own site. I forgot who created it tho so i cant find it unless i search thru all the samples... thats alot, so ill just link to the fla here.
The thing is that this menu has links, that i want to open a html in a frame below the one this menu is in. But the links arent button instances so the 'on release geturl' blabla doesnt work.
I read somewhere i could post code here, so...
stop();
function createMenu(names, targets, labels, x, y) {
this.itemName = names.split(",");
this.itemTarget = targets.split(",");
this.frameLabel = labels.split(",");
_root.menuBase.duplicateMovieClip("menu_1", 1);
this._x = x;
this._y = y;
for (i=1; i<=this.itemName.length; i++) {
this.attachMovie("menuItem", "menuItem_"+i, i);
this["menuItem_"+i].name = this.itemName[i-1];
this["menuItem_"+i].itemTarget = this.itemTarget[i-1];
this["menuItem_"+i].frameLabel = this.frameLabel[i-1];
//this["menuItem_"+i].buttonover._width = this.itemName[i-1].length;
this["menuItem_"+i]._width = this.itemName[i-1].length*10;
if (i>1) {
this["menuItem_"+i]._x = this["menuItem_"+(i-1)]._x+(this["menuItem_"+(i-1)]._width)/2+(this["menuItem_"+i]._width)/2;
}
}
}
function createsubMenu(names, targets, labels, x, y) {
this.itemName = names.split(",");
this.itemTarget = targets.split(",");
this.frameLabel = labels.split(",");
_root.submenuBase.duplicateMovieClip("menu_1", 1);
this._x = x;
this._y = y;
for (i=1; i<=this.itemName.length; i++) {
this.attachMovie("menuItem", "menuItem_"+i, i);
this["menuItem_"+i].name = this.itemName[i-1];
this["menuItem_"+i].itemTarget = this.itemTarget[i-1];
this["menuItem_"+i].frameLabel = this.frameLabel[i-1];
//this["menuItem_"+i].buttonover._width = this.itemName[i-1].length;
this["menuItem_"+i]._width = this.itemName[i-1].length*10;
if (i>1) {
this["menuItem_"+i]._x = this["menuItem_"+(i-1)]._x+(this["menuItem_"+(i-1)]._width)/2+(this["menuItem_"+i]._width)/2;
}
}
}
_root.menu.createMenu = createMenu;
_root.menu.resetMenu = resetMenu;
_root.menu.createMenu("Home,About Us,Contact,Inventory", "_root,_root,_root,_root", "main,aboutus,contact,inventory", 50, 8);
link to .fla: http://members.home.nl/nio/menu.fla
I want to change the names of the items in the list. (home, about us, contact etc.) and probably the number of items. And the names of the submenu items. I can do that, but the menu doesnt work anymore then. I also want (i want alot:P) to be able to change the menu items that have a submenu..
And have those menu items, and submenu items, actually open something in a frame below the one this menu is in.
Any help/advice/pointers in the right direction would be greatly appreciated :-)
//kabooomi
[Edited by kaboomi on 07-21-2002 at 11:36 PM]
View Replies !
View Related
Assigning Mc Instances In MX
I am having a problem with assigning onRelease action to different instances of the same mc. For some reason the same code just does not work with one of the instances.
The two instances are called 'tab1' and 'atab1' of the 'tab' mc. 'tab1' is on frame 1 of the _root and 'atab1' is on frame 2 of the _root.
The following code does exactly what it's supposed to:
Code:
_root.tab1.onRelease=function(){
gotoAndStop(2);
gotoDock();
aFade1();
loseVis25();
};
But the next code does not work:
Code:
_root.atab1.onRelease=function(){
gotoAndStop(1);
}
The instance atab1 on frame 2 has no button capability - the cursor does not even change when over it.
As you can see all I want the mc instance to do is return the _root to frame 1 of the timeline.
Anyone see what I am doing wrong?
Cheers
Charco
View Replies !
View Related
Assigning Actions To Instances
Within the movie explorer, how do I assign actions to the instance I have dragged onto the stage? I have assigned actions to the first frame, but I need to know how to assign actions to the object I have dragged into the frame. Thanks for the help.
View Replies !
View Related
Assigning Vars To MC Instances
Last edited by Bernie X : 2002-03-02 at 09:23.
More insight:
A button obj action calls the function sceneSwitch and passes a param of scene01 to the function.
For example:
on(release){
sceneSwitch(scene01);
}
function sceneSwitch (my_scene) {
if ( my_scene==_root.scene_01) {
my_scene=_root.scene_01;
my_scene._alpha=100;
// doesn't wrk
}
}
For whatever the case may be, I can't seem to sub the param for the actual MC instance in the expression to chg its alpha. So, basically....
The expression 'my_scene._alpha=100;' doesn't work.
If I use 'scene_01._alpha=100;' that works. Any suggestions?
Please advise.
BX
View Replies !
View Related
Making Instances And Assigning Variables
Hi.
Sorry to ask so many questions but;
I made a sprite, simple enough. Now I want to give the sprite 2 variables and I can't figure how to do it!
My sprite is essentially a button, with a shape and textfield instances inside it. I have got an eventListener to check if the mouse is over. If it is, it calls a function which makes another eventListener Event.ENTER_FRAME on the sprite instance to animate the shape instance inside it. But for the animation to work I need these two variables to be given to the sprite instance. But when I try to do somthing like this;
Code:
var p = buttonCreate("cool",100,10,5);
addChild(p);
function buttonCreate(txtT,wT,hT,extT) {
var a = new Sprite();
a.curExt = 0;
a.maxExt = extT;
var b = new Shape();
a.addChild(b);
var t = new TextField();
a.addChild(t);
a.addEventListener(MouseEvent.MOUSE_OVER,buttonOver);
return a;
}
It doesnt want to give it the curExt or maxExt variables. I understand that you have to make a variable with the var keywork in AS3 before it works but how do you do it externally from the instance itself?
Thanks for reading/helping,
Dan
Also how should I store an identifier to the shape instance on the sprite? Because for the animation to work I am going to need to reference to it...
View Replies !
View Related
Assigning Loader Instances To Multiple Container Clips
I have a project where I am loading in a variable quantity of photos and then assigning them to a finite amount of containers.
I have 18 containers, and I can have between 1 and 18 photos. So if I have 1 photo it should be placed in all 18 containers, if I have 2 they should each go in 9 containers.
Right now I am loading in the photos successfully but I am having issues making them children of the multiple containers.
Here's the relevant code
Code:
private function RenderPhotos():void
{
Globals.Debugger.text = "";
this.mcContainer.gotoAndStop(1);
var singleTimer:uint = 10; //Number of seconds for one photo animation.
var numPhotos:uint = URLList.length; //Number of photos
var numPlaces:uint = this.mcContainer.numChildren; //Number of slots for photos
var count:uint = 0;
for(var i:uint = 0; i < numPlaces; i++)
{
if(count > (numPhotos - 1))
{
count = 0;
}
if(PhotoList[count].content)
GetHolder(i).addChild(Loader(PhotoList[count]).content);
else
Globals.Debugger.text += "was null -- ";
count++;
}
this.mcContainer.play();
}
This method is called by the Event.COMPLETE event handler, so the content is there. This code will display the photo ONCE, in the last container it was assigned to, but I need to assign it to multiple containers...
I tried using a "duplicateMovieClip" method from a third party but it doesn't seem to support Loader too well. Anyone have any ideas?
View Replies !
View Related
Assigning Action Script To Buttons.
Hi, I've a problem assigning action scripts to buttons... can anyone help?
I did the following...
1) Insert >> New Symbol
2) Gave a name to this symbol, clicked on "button" for behavior and then clicked "OK"
3) In the symbol editing mode, I drew a button.
4) I then selected and grouped the button.
5) I then selected the button using the selection tool.
6) Then, I clicked on Windows >> Action to bring up the Object Action dialog box.
7) I clicked on "+" and tried to assign an action script to my button.
8) However, the actions were all greyed out.... and thus, I can't assign any actions to my button at all??
Can any kind souls give me any advise on this?? Thanxs a great deal
View Replies !
View Related
Assigning The Same Action To Multiple Buttons?
(Flash MX)
Can I assign the same action to multiple buttons? I have a menu where rollovers and clicks on the buttons makes an animation do various things. The only thing different that the buttons do is take you to different "pages", but otherwise the rollovers and clicks all control the same actions in the animation.
I'm just wondering if there's a more efficient way than copying and pasting the same action script to each button?
View Replies !
View Related
Problem Assigning OnPress Action
Heloo..
Okay I just have a code attaching mc for create a thumbnail...so my problem is I can't assign a onPress action..because when I test it ..it's seem not working..so I really need help u guys ...at least tell me what's wrong with this code..for load image thumnail part is okay only for assigning onpress action......
Code:
stop();
tArray = ["bear0","bear1","bear2"];
for (var i = 0; i<tArray.length; i++) {
mythumb = attachMovie("box","box"+i,10+i);
mythumb._x = 30+mythumb._width*i;
mythumb._y = 10;
var mymc = mythumb.createEmptyMovieClip("holder"+i,50+i);
mymc.loadMovie(tArray[i]+".gif",99);
/////////////only this part is not working //////////////
mymc.onPress= function(){
trace("whoopss")
}
////////////////////////////////////////////
}
Any help would be appreciate..tq in advanced...
View Replies !
View Related
Xml #2 (assigning Mouseover Action To Each Thumbnail)
my timeline code:
Code:
var xmlLoader:URLLoader;
var xmlData:XML;
function loadXml(xmlFile:String):void {
try {
xmlLoader= new URLLoader();
xmlData = new XML;
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
xmlLoader.addEventListener(IOErrorEvent.IO_ERROR, xmlLoadFail);
xmlLoader.load(new URLRequest(xmlFile));
} catch (error:Error) {
//catch errors
trace("error");
}
}
loadXml("http://ws.audioscrobbler.com/1.0/artist/Thrice/topalbums.xml");
function xmlLoadFail(event:IOErrorEvent):void {
trace("XML Error");
}
function xmlLoaded(e:Event):void {
xmlData = XML(xmlLoader.data);
loadThumbs();
}
var p:int = 0;
var changex:int = 0;
var padding:int = 110;
var pictureValue:int = 0;/
var child:MovieClip;
var loader:Loader;
var thumbLoader:Loader;
var anzahl_thumbs:Number = 5;
function loadThumbs():void {
thumbLoader = new Loader();
thumbLoader.contentLoaderInfo.addEventListener(Event.INIT, thumbLoaded);
thumbLoader.load(new URLRequest(String(xmlData.album[p].image.medium)));//access the thumbnails
p++;
}
function thumbLoaded(event:Event):void {
child = new MovieClip();
child.pictureValue = pictureValue++;
child.addChild(thumbLoader.content);
holder_mc.addChild(child);
TweenLite.from(child, 2, {alpha:0});
child.x =changex;
changex = changex+padding;
child.buttonMode = true;
child.height = 90;
child.width = 90;
thumbLoad_txt.text = "LOADED "+p +" OF "+anzahl_thumbs+" ALBUMS";
if (p<anzahl_thumbs) {
loadThumbs();//create loop
}
var holder_mc:Sprite = new Sprite();//thumbs load into
addChild(holder_mc);
holder_mc.x = 5;
holder_mc.y = 5;
now i want to assign a mouseover action to every cover thumbnail, something like
Code:
child.addEventListener(MouseEvent.MOUSE_OVER, mouseover);
function mouseover(evt:MouseEvent) {
trace (xmlData.album[p].name);
}
that example would show me the album title that belongs to the album cover thumbnail. i put the code in the loop but it didnt work ("TypeError: Error #1009: Der Zugriff auf eine Eigenschaft oder eine Methode eines null-Objektverweises ist nicht möglich" - yeah i know its german )
but i just cant figure out where to put this function to make it work. i'm not that experienced in as3, so im pretty helpless atm. a little help is very much appreciated
aaah that whole loop thing freaks me out, i hope i'll find some tutorials about this issue or at least some tutorial that will teach me how to code some decent and working loops
View Replies !
View Related
Assigning Same Action In A Multiple Buttons
Quote:
numOfPlaylist = 11;
for (var i = 1; i<=numOfPlaylist; i++) {
_root["list"+i].onRollOver = function() {
_root["playlist"+i].gotoAndPlay("over");
};
_root["list"+i].onRollOut = function() {
_root["playlist"+i].gotoAndPlay("out");
};
_root["list"+i].onPress = function() {
_root.gotoAndStop(i);
};
}
i have a buttons name list1, list2, list3 .... and movieclips so on and playlist1 , playlist2 .. and so on basically what i want to do is assign same action on it the code above is what i did and it doesn't work ... can anyone tell me whats wrong..
View Replies !
View Related
Assigning Same Action In A Multiple Buttons
Quote:
numOfPlaylist = 11;
for (var i = 1; i<=numOfPlaylist; i++) {
_root["list"+i].onRollOver = function() {
_root["playlist"+i].gotoAndPlay("over");
};
_root["list"+i].onRollOut = function() {
_root["playlist"+i].gotoAndPlay("out");
};
_root["list"+i].onPress = function() {
_root.gotoAndStop(i);
};
}
i have a buttons name list1, list2, list3 .... and so on and movieclips playlist1 , playlist2 .. and so on basically what i want to do is assign same action in the buttons, the code above is what i did and it doesn't work ... can anyone tell me whats wrong..
View Replies !
View Related
Problem Assigning OnPress Action
Heloo..
Okay I just have a code attaching mc for create a thumbnail...so my problem is I can't assign a onPress action..because when I test it ..it's seem not working..so I really need help u guys ...at least tell me what's wrong with this code..for load image thumnail part is okay only for assigning onpress action......
ActionScript Code:
stop();tArray = ["bear0","bear1","bear2"];for (var i = 0; i<tArray.length; i++) { mythumb = attachMovie("box","box"+i,10+i); mythumb._x = 30+mythumb._width*i; mythumb._y = 10; var mymc = mythumb.createEmptyMovieClip("holder"+i,50+i); mymc.loadMovie(tArray[i]+".gif",99);//////////////// only this part it's not working ////////////// mymc.onPress= function(){ trace("whoopss") }//////////////////////////////////////////////}
Any help would be appreciate..tq in advanced...
View Replies !
View Related
How Do I Put Multiple Instances In One Action?
So here is what I've got:
//
on (releaseOutside, rollOver) {
gotoAndPlay("go");
}
on (rollOut) {
gotoAndPlay("out");
}
on (release) {
this.gotoAndStop(25);
if (_parent.mc1._currentframe>1) {
_parent.mc1.gotoAndPlay("out");
}
}
on (release) {
if (_parent.mc2._currentframe>1) {
_parent.mc2.gotoAndPlay("out");
}
}
on (release) {
if (_parent.mc3._currentframe>1) {
_parent.mc3.gotoAndPlay("out");
}
}
on (release) {
if (_parent.mc4._currentframe>1) {
_parent.mc4.gotoAndPlay("out");
}
}
on (release) {
if (_parent.mc5._currentframe>1) {
_parent.mc5.gotoAndPlay("out");
}
}
on (release) {
if (_parent.mc6._currentframe>1) {
_parent.mc6.gotoAndPlay("out");
}
}
//
So How do I put all of thes into one
on (release) { action?
Your help is very much appreciated. THANKS!!!
View Replies !
View Related
Adding Action Script To Instances...
I'm pretty frustrated and am done searching the site. Awful...just awful. Anyway...
Using Flash CS3 for the first time since upgrading. I'm not able to add action script to instances. Certainly this isn't a change. I've created a button symbol. I've named the instance upon dragging it on the stage. Now it tells me I can't apply actions to it.
I hope I'm just missing a step.
View Replies !
View Related
Press Action In Graphic Instances
I got an imported round graphic and would like to add so actionscript so that when i click the graphic it will go to xxx frame.
I tried the on (press) command it said this only use in button instances.How can I make this in graphic instances??
View Replies !
View Related
Tarhetting Multpe Instances For A 'setProperty' Action
IS it possible to list several instances to be affected by a get property, eg:
setProperty ("home", _alpha, "80");
setProperty ("tv", _alpha, "50");
setProperty ("comp", _alpha, "50");
setProperty ("links", _alpha, "50");
setProperty ("shop", _alpha, "50");
Here just end up with one setProperty action
View Replies !
View Related
Changing Graphic Symbol Instances From Action Script
FLASH MX
1) ACTION SCRIPT INSTANCE SWAPS
I have a little movie clip that zooms a picture in and out. I want to play the movie clip over and over but with a different image each time a button is clicked. Will I be able to do the equivalent of the SWAP INSTANCE button?
2) BROKEN TWEENS
I wonder if this will be appropriate anyway as I have trouble changing it by hand as it breaks the TWEEN I have between 2 keyframes using the same symbol, a small version going to a big version.
3) NUMERIC RESIZES
Nightmare anyways as my version of Flash won't allow me to change an instance size to 3000 pixels, I get an INVALID SIZE AND POSITION error but I can use the SCALE TOOL to get there with a lot of faffing about.
This is all driving me spare, any suggestions. )c8
View Replies !
View Related
Action Script In Child Movie Clips, Instances, Symbols( Problem)
Hi,
Have come across a problem when trying to use action script in a movie clip symbol (created in the Library) and using an instance in a layer in the main move.
The action script which is in the movie clip instance seems to work differently to how it would if the exact same code was in a script layer in the main time line (or u could say that is doesn't work the the way it should).
I have 2 examples of this:
- XML.load(); loads but does not parse (ie load xml into DOM), yet returns success = true in the onLoad call back.
- scope of Array objects seems to be limited. That is an array (in this case containing the XML) is not accessible from the next frame. or rather does not exist in the next frame. Trying to assign this array to a globaly declared array results in a zero length array.
has anybody come across this before? if so is this a known problem or am i doing something wrong?
thanks
View Replies !
View Related
Assigning A Url To A Button
I read this http://www.macromedia.com/support/fl...up_windows.htm
I want my window to popup a button.
I know how to assign a url to a button. Such as my site at http://people.txucom.net/kicker
But I want a click from the new window to open the second button.
can someone read this webpage at macromedia and tell me how to assign a window to a button. I want the window to be clicked and a new button to show. Right now the first button goes to the searchbox that if you type a search term you get a window from clicking on the new window, I want a second button to appear.Down the Line
I want the same effect as http://www.bonus4u.da.ru
View Replies !
View Related
Problem Assigning Button
hi, i've been having trouble assigning the right path to my buttons. Actually, i made one general button with different variable names...
now i just want to assign my button to the movie 'merkenvenster' were you can find a frame with the same label as the variablename of the button pressed...
the actionscript for th buttinaction is
on (release) {
_root.merkenvenster.gotoAndPlay("/:" add eval("..:text"));
}
but i guess you would have to look at the fla...
please help me, i tried everything
View Replies !
View Related
Assigning XML Variables To A Button
Hi,
Im designing an interactive database interface for an aquarium, I have moving buttons which when clicked I would like to go to another movie which will load the details of a specific fish.
At the moment my movie which displays the data only loads the details of a specific fish (I can change this by changing the values of the nodes specified below)
My code so far:
data = new XML();
data.ignoreWhite = true;
data.load("aquarium.txt");
data.onLoad = function(success){
if (success){
if(data.status==0){
thisFish = data.childNodes[0].childNodes[0];
parseData(thisFish);
}else{
trace("Parse Error: "+data.status);
}
}else{
trace("Load Error")
}
}
function parseData(fish){
//userFish = fish.childNodes[0];
this["fish name"] = fish.childNodes[0].childNodes[0].nodeValue;
this["fish eats"] = fish.childNodes[1].childNodes[0].nodeValue;
this["fish habits"] = fish.childNodes[2].childNodes[0].nodeValue;
}
I understand that I will have to assign the XML data to an array, my problem is how do I assign variable values to a button so as when the new movie loads the details specific to that button will be loaded in the text areas?
Please help - I can't afford to loose any more hair!!
Steve
View Replies !
View Related
[F8] Assigning Two Functions To A Button
Hi there,
I would like a single button press two run two functions together. I have a movieclip on the stage, instance name ny that has two frames, the scond frame being a different colour to the first frame.
When I press the button I want it to goto frame 2 and perform a trace statement...
var score:Number = 0;
function addScore(new_score:Number) {
score += new_score;
}
var ny:MovieClip;
ny.onPress =addny+democrat;
function democrat():Void {
this.gotoAndStop(2);
}
function addny():Void {
addScore(40);
trace("Total votes are "+score);
ny.stop();
}
What I'm hoping for is the mc to change colour and output the statement "Total votes are 40". The first function is so I can add further movie clips and assign them scores to add as well so I can have a running total.
Also does anyone know how I can disable the movieclip after it's been pressed to avoid the user from adding the total repeatedly for the mc?
Any help is greatly appreciated
Best
Steve
View Replies !
View Related
Assigning A Value To A Radio Button
Hi,
I have a set of radio buttons on a form which allows the user to select "Yes" or "No". If the user selects yes I need a rate to appear in the output. Here is some of the code I have so far:
var winterSportsCover:Boolean; // radio buttons - no default
var baggageCover:Boolean; // radio buttons - no default
//validation
// winter sports cover
function validateWinterSportsCover()
{
//assign result of radio button selection to root variable
this.winterSportsCover = this.formElements_mc.winterSportsCoverRadioBtns_mc .RadioBtnsResult;
//if user has neither selected 'yes' or 'no'
if(this.winterSportsCover == undefined)
{
this.winterSportsCoverValidatedOk = false;
this.formLegends_mc.winterSportsCoverLegend_txt.te xtColor = this.errorTextColor;
}
//if user selects 'yes'
else if(this.winterSportsCover == true)
{
this.winterSportsCoverValidatedOk = true;
this.formLegends_mc.winterSportsCoverLegend_txt.te xtColor = this.regularTextColor;
}
//if user selects 'no'
else if(this.winterSportsCover == false)
{
this.winterSportsCoverValidatedOk = true;
this.formLegends_mc.winterSportsCoverLegend_txt.te xtColor = this.regularTextColor;
}
}
// baggage cover
function validateBaggageCover()
{
//assign result of bullet selection to root variable
this.baggageCover = this.formElements_mc.baggageCoverRadioBtns_mc.Radi oBtnsResult;
//if user has neither selected 'yes' or 'no'
if(this.baggageCover == undefined)
{
this.baggageCoverValidatedOk = false;
this.formLegends_mc.baggageCoverLegend_txt.textCol or = this.errorTextColor;
}
//if user selects 'yes'
else if(this.baggageCover == true)
{
this.baggageCoverValidatedOk = true;
this.formLegends_mc.baggageCoverLegend_txt.textCol or = this.regularTextColor;
}
//if user selects 'no'
else if(this.baggageCover == false)
{
this.baggageCoverValidatedOk = true;
this.formLegends_mc.baggageCoverLegend_txt.textCol or = this.regularTextColor;
}
// FOR TESTING ONLY - trace annual results
trace("winterSportsCover = "+_root.winterSportsCover);
trace("baggageCover = "+_root.baggageCover);
trace("FORM VALIDATED OK = "+formValidatedOk);
so I need the following to trace according to if the user selects yes or no!
BaggageNo = 1.0000;
BaggageYes = 1.2777;
WinterSportsNo = 1.0000;
WinterSportsYes = 1.3824;
It sounds complicted when I look at this but I'm sure there is a simple way of doing it - I just need to assign a value to radio buttons. Can anyone help me please!
View Replies !
View Related
Assigning Actionscript To Button And MC-Help
Hi:
I am trying to assigning an on(release) script to a button (up state) which leads to a rotating cube (movie clip) on the over and down states. However, the rotation works on the over and down states of the mc, but the actionscript does not work to getURL(jcroofing/index.html). I added this script onto the movieclip first as an onClipEvent and then as a onMouseDown, but it doesn't work.
The button (up state) has a similar script which does not work on(press, release) {getURL ("jcroofing/index.html", _blank). I thought I should use the forward slash because the html page is in another folder outside of the flash folder called jcroofing.
I thought I would put scripts on both the button and mc just in case the user pressed the button in the up state or the mc in the over/down state. Nothing works. Where am I going wrong? I have three books on actionscript and I can't find the answer. I'm so frustrated...
Thanks.
View Replies !
View Related
Dynamic Button Assigning Help? Please
Hi,
I don't know if this is the best method to do this. I am trying to set a mouse event for each movieclip. Within that movieclip, image.imageMc is the button and I want image.movieFrame to fade down. I cannot get my head around it!!!!!!!?
ActionScript Code:
for(var i:Number=0; i<8; i++) {
var image:MovieClip = new imageHolder();
image.name = "image"+i;
image.x = i*285;
image.filters = [ds];
image.imageMc.id = i;
image.imageMc.addEventListener(MouseEvent.MOUSE_OVER, onOver);
image.imageMc.addEventListener(MouseEvent.MOUSE_OUT, onOut);
scrollBox.content.addChild(image)
}
function onOver(evt:MouseEvent):void {
Tweener.addTween(["image"+evt.id].movieFrame, {_color:0x00000, time:0.25, delay:0, transition:"linear"})
};
function onOut(evt:MouseEvent):void {
Tweener.addTween(["image"+evt.id].movieFrame, {_color:null, time:1});
};
View Replies !
View Related
Assigning Actions To A Button
HI
Im about to create my first flash website.
I am using some text as a button and when im trying to assign some actionscript to that button it says in the actions panel something like it cant assign actions to this.
Its probarly very easy to solve so i hope someone out there can help me.
View Replies !
View Related
Assigning Button Functions
having a little trouble with this one. i'm creating a series of buttons that all need to run the same function of click but need to pass it different paramaters.
i've been tryingg:
myClip.myButton.onRelease = myFunction;
this works, but as soon as i try myFunction(param); it gets all messed up. if anyone knows how to do this so that i don't have to hard code all the buttons i'd love to hear it.
cheers
View Replies !
View Related
Assigning A Variable To A Pushed Button
hello. i have a survey that people will start taking tomorrow and it is done in flash 5.
i have little buttons on each screen that people can click on to have the contents of the screen read to them. i want to check to see whether people are using these buttons, but i don't know how to do it. i clicked on the button and brought it up. i can see where i added the sound in the third frame over, but i am not allowed to add an action to the frames in the button mode. i merely want to change the value of variable from 1 to 2. why is it grayed out? is there a way around this?
View Replies !
View Related
Problem In Making Assigning Button
I have a problem in assigning the functions to my buttons.
Im a new user who dun have any experiences in doing flash movies.
I wanted to assign my button in a way that when i clicked it, it will link me to the next scene, however i dun have it to play the next scene or loop.
Can anyone kindly advise me?
Thank You
View Replies !
View Related
Assigning Button Events In ActionScript
Hi I was wondering how I could assign MULTIPLE button events to my button through actionscript.
I had:
myButton_btn.onRollOver = function() {
...my actions
};
But I need something like:
myButton_btn.onRelease = onPress = onReleaseOutside = onRollOut = function() {
...my actions
};
(Ok, I know don't laugh, I'm still new to this )
Anyway it doesn't want to work that way. Anybody know what I'm doing wrong?
Thanks for any help,
A
View Replies !
View Related
Assigning Actions To A Specific Button
I'm trying to assign these button actions to a specific button....
----------
on (release)
{
frame.nWidth = 100;
frame.nHeight = 300;
frame.nxPos = 300;
frame.nyPos = 100;
}
-------------
Sounds easy enough, but the button(s) is being made by duplicate movie clip (see below) and I don't know how to attach these instructions to the specific button.
------------
nomi = new Array("HOME", "PROFILE","PORTFOLIO","EXPERIMENTAL");
max = 3
for(i=1;i<=max;i++){
duplicateMovieClip("_root.menu0","menu"+i,i)
myMenu = _root["menu"+i]
myMenu.mov.txt = nomi[i]
myMenu.attachMovie(loghi[i],"logo" + i,(5000+i))
myLogo = eval("_root.menu" + i + ".logo" + i)
myLogo._x = -76
}
------------
Thank you for your help.
View Replies !
View Related
AUGH PLEASE HELP - Assigning Colour Value To Button
Hey Guys,
Ok i am tyring to do something pretty complicated here (well to me anyway) and would love some help because I dont think I can do it myself.
What I have is an xml sheet which has colour values in it that flash can pull in and read no prob. The problem is that the only way I can pass these values to the button at the moment is by a drop down.
What I need is 3 buttons on the stage and each of them have thier colours set on load. I really hope someone can help because I am getting nowhere fast.
You can get the flash file and XML here
http://360id.com.au/colour/people.xml
http://360id.com.au/colour/peopledisplay04.fla
Here is the XML save and name people.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<people lastupdate="9/14/2005" dir="">
<person name="green" lotcolor="78A615">
</person>
<person name="black" lotcolor="000000">
</person>
<person name="blue" lotcolor="374B9F">
</person>
</people>
and the actionscript is this
Code:
////////////////////////////////////////////////////////
// import this so it can be used to set the scope of the combobox listener and the xml onload routine
import mx.utils.Delegate;
// create a new color object to associate with the bgcolor movieclip
var bgcol:Color;
// set up the XML instance
var peoplexml:XML = new XML();
// initialize items on stage
// define what should happen when the XML loads
// (read data into update, dirpath, and people variables)
function onXmlLoaded(success:Boolean) {
if (success) {
// set up an array of all person nodes
var peoplenodes:Array = peoplexml.firstChild.childNodes;
for (var i:Number = 0; i < peoplenodes.length; i++) {
// for each person node:
var personnode:XMLNode = peoplenodes[i];
people.push(
{i:i+1,
pname:personnode.attributes.name,
lot:parseInt(personnode.attributes.lotcolor, 16),
links:personnode.childNodes[2].firstChild.nodeValue
});
}
// data is all read and put in the right place -- now setup the screen
// using this data
setup();
} else {
trace('error reading XML');
}
}
function setup() {
// set up chooseperson dropdown
chooseperson.labelField = "pname";
chooseperson.dataProvider = people;
chooseperson.addEventListener("change", Delegate.create(this, loadScreen));
}
function loadScreen(evt:Object) {
var thisitem:Object = evt.target.selectedItem;
bgcol.setRGB(thisitem.lot);
}
////////////////////////////////////////////////////////
function init() {
// initialize the people array
people = [{pname:"Choose one"}];
// set up the xml instance to ignore whitespace between tags
peoplexml.ignoreWhite = true;
// set the scope of the onLoad function to the main timeline, not peoplexml
peoplexml.onLoad = Delegate.create(this, onXmlLoaded);
// initialize the bgcol color variable by associating it with the background movieclip
bgcol = new Color(lot);
// start the xml loading
peoplexml.load("people.xml");
}
init();
////////////////////////////////////////////////////////
View Replies !
View Related
Assigning Button Actions In A Loop
I have a for loop that goes through an XML file and extracts the data and attaches a movieclip to the stage for each node is runs across (in this case we'll say there are 2 nodes). There is an attribute "date" in my xml file and it is assigned in flash to a variable "date" within the loops, so I should have 2 different dates. When I try to make my buttons trace the value of date on rollOver they both output the same thing, the last instance of date. How do I fix this? I really hope all that made some sense. My code is attached below.
code:
var newsCSS:Object = new TextField.StyleSheet();
newsCSS.load("../css/news_styles.css");
var newsData:XML = new XML();
newsData.ignoreWhite = true;
newsData.onLoad = loadNews;
newsData.load("../data/news.xml");
var rootNode:XMLNode;
function loadNews(success:Boolean) {
if (success) {
rootNode = this.firstChild;
var spacing:Number = 35;
for (i:Number = 0; i < rootNode.childNodes.length; i++) {
var newName:String = "news_item_" + i + "_mc";
var headline:String = rootNode.childNodes[i].attributes.headline;
var date:String = rootNode.childNodes[i].attributes.date;
var story:String = rootNode.childNodes[i].firstChild.nodeValue;
var newY:Number = i * spacing;
news_container_mc.attachMovie("news_item", newName, i);
news_container_mc[newName].story_txt.styleSheet = newsCSS;
news_container_mc[newName].headline_txt.text = headline;
news_container_mc[newName].date_txt.text = date;
news_container_mc[newName].story_txt.htmlText = story;
news_container_mc[newName]._y = newY;
news_container_mc[newName].invis_btn.onRollOver = function() {
trace(date);
}
}
} else {
trace("error loading file");
}
}
stop();
View Replies !
View Related
Assigning Button Events With A Loop
I'm trying to assign a bunch of buttons's events using a loop, instead of always having to rewrite the cumbersome
Code:
btn1.onRelease = function () {
trace("my event here");
}
I have 5 buttons, named btn1, btn2, btn3, btn4, btn5.
here's my code:
Code:
for (i=0;i<5;i++) {
this["btn" + i].onRelease = function () {
trace("btn " + i + "is pressed");
}
}
However what this does is makes all the buttons trace "btn5 is pressed".
Why is it not working?
I've used loops like this before to control movieclips and buttons "enabled" property. Why is it not working with the onRelease function?
MB
View Replies !
View Related
Assigning Button Actions Within A Loop
This function all works correctly, except where i am assigning an action to the onRelease event of a given button. Every button is assigned to the same value (appears to be the first value pulled from the array). Pretty frustrating...help?!
function createSubItems() {
vspacer = 6;
i = 0;
_global.subHeights = [];
for (j=1; j<=7; j++) {
subOf = "item"+j+"_sub";
subName = eval(_root.subOf);
hotspot = subName.hotspot;
linkArea = subName.linkArea;
colorArea = subName.colorArea;
totalTextHeight = 0;
totalTextWidth = 0;
lvl = 0;
spacer2 = 4;
//create links
tracker = 0;
while (xmlSubLinks[i] != "endsection") {
createLinkText(xmlSubLinks[i], subName, subOf, lvl, 0x000000);
if (clipName._width>totalTextWidth) {
totalTextWidth = clipName._width;
}
_global.level++;
clipName._y = vspacer+totalTextHeight;
clipName._x = colorArea._x+8;
totalTextHeight += 20;
//increment
i += 2;
lvl++;
tracker++;
}
i += 2;
//size & position subName
if (tracker>0) {
linkArea._height = totalTextHeight+1;
linkArea._width = (spacer-spacer2)+totalTextWidth+(spacer-spacer2);
colorArea._width = linkArea._width+(7);
colorArea._height = totalTextHeight+(spacer2*2)+1;
_global.subHeights[j] = colorArea._height;
colorArea._y = 0;
colorArea._x = 0;
linkArea._y = colorArea._y+spacer2;
linkArea._x = colorArea._x+spacer2;
}
//draw stuff for the links
bottomOfLink = spacer2;
for (k=0; k<tracker; k++) {
trace(xmlSubLinks[k+1]);
bottomOfLink += 20;
subName.createEmptyMovieClip("line"+k, k);
subName.createEmptyMovieClip("link"+k, k+tracker);
//draw line
eval(subName+".line"+k).lineStyle(1, 0xA3A19E, 100);
eval(subName+".line"+k).moveTo((linkArea._x+linkAr ea._width)-1, bottomOfLink);
if (k<tracker-1) {
eval(subName+".line"+k).lineTo(linkArea._x, bottomOfLink);
}
//duplicate and move button
subName.linkBox.duplicateMovieClip("linkBox"+k, -tracker+k);
linkBoxName = eval(subName+".linkBox"+k);
linkBoxName._height = 18.8;
linkBoxName._y = bottomOfLink-19;
linkBoxName._x = linkArea._x+.75;
linkBoxName._width = linkArea._width-2.5;
linkBoxName._alpha = 0;
//create button actions
fadeSpeed = 35;
linkBoxName.onRollOver = function() {
this.onEnterFrame = function() {
if (this._alpha<100) {
this._alpha += fadeSpeed;
}
};
};
linkBoxName.onRollOut = function() {
this.onEnterFrame = function() {
if (this._alpha>0) {
this._alpha -= fadeSpeed;
}
};
};
linkBoxName.onRelease = function() {
getURL(xmlSubLinks[k+1]);
trace(xmlSubLinks[k+1]);
};
}
//position main area
subName._y = StageHeight;
subName._x = eval("boxes.item"+j+"_box")._x;
if (subName._x+colorArea._width>StageWidth) {
subName._x -= colorArea._width;
if (j != total) {
subName._x += (eval("boxes.item"+(j+1)+"_box"))._x-(eval("boxes.item"+(j)+"_box"))._x;
} else {
subName._x += StageWidth-(eval("boxes.item"+(j)+"_box"))._x;
}
}
subName.linkBox._visible = false;
subName._visible = false;
}
}
View Replies !
View Related
Assigning A Pushed State For A Button
Im trying to make a movieclip appear when i press a button, but it will only show when the mouse it held down. I tried putting the clip in the "Hit" section as well as "over" and "down" ones, but nothing seems to work. Im sure its somthing simple, I just don't know what!
Thanks for any help you can give me
Nuke
View Replies !
View Related
Multiple Button Instances From Single Button Symbol?
Greetings,
I would like to create a single button symbol, place multiple instances of it in a scene then change the text and target URL for each button instance. I once saw and advanced button tutorial that explained how to do this very clearly. I believe it used dynamic text inside a button symbol. Has anybody seen this tutorial? If not, is this easy to explain in a forum such as this?
Thanks!
Steve
View Replies !
View Related
Assigning Flash Button To Form Submission
Ok, Here is what I have:
I created a strip of buttons. 4 of them go to normal urls, the 5th is a img of a shopping cart, I want to assign the following to this button:
>FORM action=https://www.yowcow.com/cart/ method=post target=yowcow<
>INPUT type=hidden value=emailgoeshere name=business<
>INPUT type=hidden value="itemgoeshere " name=item_name<
>INPUT type=hidden value=275 name=amount<
>INPUT type=image alt="Make payments with YowCow - it's fast, free and secure!" src="images/flashbuttoncart.gif" border=0 name=submit<
>/FORM<
Right now the form action has an input set for a button, but I can't figure out how to get this to work with my flash button. (ignore the opening and closing carets, I did that so the forum wouldn't read this as a form).
Any help would be greatly appreciated.
John.
View Replies !
View Related
Assigning Selected Radio Button To A Variable
First time using FK, and relatively novice in Flash. The simple way to describe my scenario is this: Imagine there is a simple button on top of the stage, then 3 radio buttons on the buttom of the stage, I need to write a function / conditional statementt that assigns a value to a public variable depending which radio r_button is selected.
Then when the user clicks on the button on the top, this variable will be used in AS code to perform diffferent actions (depending which radio button has been selected).
The part I have problem with is a method or funtion with correct syntax to detect which rb is selected and assigns it to a variable.
I appreciate any help,
Thanks
Max
View Replies !
View Related
[CS3] Assigning Button Controls Using An Array And For Loop
I'm curious as to why the following doesn't result in creating usable buttons? I've found that I can actually define the array myself rather than using a for loop and that seems to work. Any ideas why building the array in the loop causes the onRollOver event to fail?
This is all AS2 by the way.
Code:
var seriesBtns:Array = new Array();
for (i=0; i<3; i++) {
// Build the array
var curBtn;
curBtn = "series"+(i+1)+"_btn"; // results in series1_btn, series2_btn
//Add to array
seriesBtns.push(curBtn);
//When array is created do the following
if (i == 2) {
for (j=0; j<3; j++) {
// RollOver actions
var btn = seriesBtns[j];
trace(btn); // Outputs series1_btn, series2_btn, etc.
btn.onRollOver = function() {
// Button action here
}
}
}
}
View Replies !
View Related
|