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








Changin Global Var On Runtime From Within Button?


I've been playing with writing a simple script that would entirely depend on a few variables declared right on top of it. Is there a way of changing them (in my case values of p, q, a & b) with a button if the button is part of the script?
Here's the script (just copy and paste entire thing into the first frame);


ActionScript Code:
//number of buttons & imagesvar n = 4;//indexing of buttons and images starts from:var k = 0;//starting left align point (_x value):var p = 100;//starting left align point (_y value) for images and buttons:var q = 100;//movie clip width:a = 400;//movie clip height:b = 200;//create a script assigning RGB color to a clipfunction combineRGB (red, green, blue) {        //combine the color values into a single number        var RGB = (red << 16) | (green << 8) | blue;        return RGB;}MovieClip.prototype.setRGB = function (colorValue) {        new Color (this).setRGB (colorValue);};//set colors:color0 = combineRGB (44, 115, 30);color1 = combineRGB (76, 98, 139);color2 = combineRGB (124, 54, 52);color3 = combineRGB (92, 92, 118);color4 = combineRGB (119, 91, 80);color5 = combineRGB (132, 74, 50);white = combineRGB (255, 255, 255);grey = combinedRGB (127, 127, 127);black = combineRGB (0, 0, 0);//declare a new Array: "colors" for retrieving values latercolors = [color0, color1, color2, color3, color4, color5, white, grey, black];//create a movie clip:this.createEmptyMovieClip ("container_mc", 200);this.container_mc.moveTo (p, q);this.container_mc.beginFill (0xFF0000);this.container_mc.lineTo (p + a, q);this.container_mc.lineTo (p + a, q + 200);this.container_mc.lineTo (p, q + 200);this.container_mc.lineTo (p, q);this.container_mc.endFill;//create buttons for controlling which images will slide into positionfor (i = k; i < n; i++) {        this.createEmptyMovieClip ("btn" + i + "_mc", i + 100);        //button height:        var bh = 8;        //spacing between buttons:        var bs = 8;        //button width:        var bw = (a - (n - 1) * bs) / n;        //button distance from the container clip:        var bd = bh * 2;        this["btn" + i + "_mc"].moveTo (p, q - bd);        this["btn" + i + "_mc"].beginFill (0xFF0000);        this["btn" + i + "_mc"].lineTo (p + bw, q - bd);        this["btn" + i + "_mc"].lineTo (p + bw, q - (bd - bh));        this["btn" + i + "_mc"].lineTo (p, q - (bd - bh));        this["btn" + i + "_mc"].lineTo (p, q - bd);        this["btn" + i + "_mc"].endFill;        //position buttons:        for (r = k + 1; r < n; r++) {                this["btn" + r + "_mc"]._x = (this["btn" + (r - 1) + "_mc"]._x) + (this["btn" + (r - 1) + "_mc"]._width + bs);        }}for (i = k; i < n; i++) {        this["btn" + i + "_mc"].onRelease = function () {                var btNameString = getProperty (this, _name);                t = btNameString.charAt (3);                container_mc.setRGB (colors[t]);        };}



I would want my container (and buttons since they're attached) to change position or size when the buttons are clicked so essentially I'd like to be able to change p and q values.




KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 04-26-2005, 02:42 AM


View Complete Forum Thread with Replies

Sponsored Links:

Changin Global Var On Runtime From Within Button?
I've been playing with writing a simple script that would entirely depend on a few variables declared right on top of it. Is there a way of changing them (in my case values of p, q, a & b) with a button if the button is part of the script?
Here's the script (just copy and paste entire thing into the first frame);


ActionScript Code:
//number of buttons & imagesvar n = 4;//indexing of buttons and images starts from:var k = 0;//starting left align point (_x value):var p = 100;//starting left align point (_y value) for images and buttons:var q = 100;//movie clip width:a = 400;//movie clip height:b = 200;//create a script assigning RGB color to a clipfunction combineRGB (red, green, blue) {        //combine the color values into a single number        var RGB = (red << 16) | (green << 8) | blue;        return RGB;}MovieClip.prototype.setRGB = function (colorValue) {        new Color (this).setRGB (colorValue);};//set colors:color0 = combineRGB (44, 115, 30);color1 = combineRGB (76, 98, 139);color2 = combineRGB (124, 54, 52);color3 = combineRGB (92, 92, 118);color4 = combineRGB (119, 91, 80);color5 = combineRGB (132, 74, 50);white = combineRGB (255, 255, 255);grey = combinedRGB (127, 127, 127);black = combineRGB (0, 0, 0);//declare a new Array: "colors" for retrieving values latercolors = [color0, color1, color2, color3, color4, color5, white, grey, black];//create a movie clip:this.createEmptyMovieClip ("container_mc", 200);this.container_mc.moveTo (p, q);this.container_mc.beginFill (0xFF0000);this.container_mc.lineTo (p + a, q);this.container_mc.lineTo (p + a, q + 200);this.container_mc.lineTo (p, q + 200);this.container_mc.lineTo (p, q);this.container_mc.endFill;//create buttons for controlling which images will slide into positionfor (i = k; i < n; i++) {        this.createEmptyMovieClip ("btn" + i + "_mc", i + 100);        //button height:        var bh = 8;        //spacing between buttons:        var bs = 8;        //button width:        var bw = (a - (n - 1) * bs) / n;        //button distance from the container clip:        var bd = bh * 2;        this["btn" + i + "_mc"].moveTo (p, q - bd);        this["btn" + i + "_mc"].beginFill (0xFF0000);        this["btn" + i + "_mc"].lineTo (p + bw, q - bd);        this["btn" + i + "_mc"].lineTo (p + bw, q - (bd - bh));        this["btn" + i + "_mc"].lineTo (p, q - (bd - bh));        this["btn" + i + "_mc"].lineTo (p, q - bd);        this["btn" + i + "_mc"].endFill;        //position buttons:        for (r = k + 1; r < n; r++) {                this["btn" + r + "_mc"]._x = (this["btn" + (r - 1) + "_mc"]._x) + (this["btn" + (r - 1) + "_mc"]._width + bs);        }}for (i = k; i < n; i++) {        this["btn" + i + "_mc"].onRelease = function () {                var btNameString = getProperty (this, _name);                t = btNameString.charAt (3);                container_mc.setRGB (colors[t]);        };}



I would want my container (and buttons since they're attached) to change position or size when the buttons are clicked so essentially I'd like to be able to change p and q values.

View Replies !    View Related
Changin Global Var On Runtime From Within Button?
I've been playing with writing a simple script that would entirely depend on a few variables declared right on top of it. Is there a way of changing them (in my case values of p, q, a & b) with a button if the button is part of the script?
Here's the script (just copy and paste entire thing into the first frame);

ActionScript Code:
//number of buttons & images
var n = 4;
//indexing of buttons and images starts from:
var k = 0;
//starting left align point (_x value):
var p = 100;
//starting left align point (_y value) for images and buttons:
var q = 100;
//movie clip width:
a = 400;
//movie clip height:
b = 200;
//create a script assigning RGB color to a clip
function combineRGB (red, green, blue) {
    //combine the color values into a single number
    var RGB = (red << 16) | (green << 8) | blue;
    return RGB;
}
MovieClip.prototype.setRGB = function (colorValue) {
    new Color (this).setRGB (colorValue);
};
//set colors:
color0 = combineRGB (44, 115, 30);
color1 = combineRGB (76, 98, 139);
color2 = combineRGB (124, 54, 52);
color3 = combineRGB (92, 92, 118);
color4 = combineRGB (119, 91, 80);
color5 = combineRGB (132, 74, 50);
white = combineRGB (255, 255, 255);
grey = combinedRGB (127, 127, 127);
black = combineRGB (0, 0, 0);
//declare a new Array: "colors" for retrieving values later
colors = [color0, color1, color2, color3, color4, color5, white, grey, black];
//create a movie clip:
this.createEmptyMovieClip ("container_mc", 200);
this.container_mc.moveTo (p, q);
this.container_mc.beginFill (0xFF0000);
this.container_mc.lineTo (p + a, q);
this.container_mc.lineTo (p + a, q + 200);
this.container_mc.lineTo (p, q + 200);
this.container_mc.lineTo (p, q);
this.container_mc.endFill;
//create buttons for controlling which images will slide into position
for (i = k; i < n; i++) {
    this.createEmptyMovieClip ("btn" + i + "_mc", i + 100);
    //button height:
    var bh = 8;
    //spacing between buttons:
    var bs = 8;
    //button width:
    var bw = (a - (n - 1) * bs) / n;
    //button distance from the container clip:
    var bd = bh * 2;
    this["btn" + i + "_mc"].moveTo (p, q - bd);
    this["btn" + i + "_mc"].beginFill (0xFF0000);
    this["btn" + i + "_mc"].lineTo (p + bw, q - bd);
    this["btn" + i + "_mc"].lineTo (p + bw, q - (bd - bh));
    this["btn" + i + "_mc"].lineTo (p, q - (bd - bh));
    this["btn" + i + "_mc"].lineTo (p, q - bd);
    this["btn" + i + "_mc"].endFill;
    //position buttons:
    for (r = k + 1; r < n; r++) {
        this["btn" + r + "_mc"]._x = (this["btn" + (r - 1) + "_mc"]._x) + (this["btn" + (r - 1) + "_mc"]._width + bs);
    }
}
for (i = k; i < n; i++) {
    this["btn" + i + "_mc"].onRelease = function () {
        var btNameString = getProperty (this, _name);
        t = btNameString.charAt (3);
        container_mc.setRGB (colors[t]);
    };
}


I would want my container (and buttons since they're attached) to change position or size when the buttons are clicked.

View Replies !    View Related
Help Needed In Creating Runtime Global Variables
Hi,

I have this wierd problem where I have to create a global variable during runtime.

Here the variable's name is stored in another variable, say....

var var_name="family"


now I should be able to create a global object ( i.e it should be declared as _global.family ) by using the variable var_name.

But the loophole is that, after creating this global variable I should be able to access it using the following command.

i.e. directly as

_global.family

I tried out many combinations but am unable to find a solution..

Any ideas anyone...

View Replies !    View Related
Image Changin
Hi, I'm trying to do the following:

Have a frame in which depending with the value of a variable an object (image) will appear.

Let me explain. Let's say the variable has a value of 1, so the image that will appear on the frame will be a car, but if the value is 2, the image will be a boat, and so on for all the different values of the variable.

Also, I need every object to appear on a different specific place on the frame (cordenates).

HOW DO I DO THESE TWO THINGS???

CAN ANYONE GIVE ME HAND PLEASE?

Thanks a lot.

T.

View Replies !    View Related
Changin Color
Hi
I need to change the color of a movieclip. I've got three knobs, that each represents the colors Red, Green and Blue (RGB). Rotating the knobs, will make the values for each color change, and thereby change the color of the MC on the fly. The last part, is making my head spin.
Take a look and the Flash file, and tell me what you think. Best of all what be an example.

http://www.larsliin.dk/color.fla
Hope you can help me out
Thanks, Lars

View Replies !    View Related
3D Carosel Changin The AS
Hello
I am 13 and one month. I have been doing flash for 4 years. I am not very good at actionscript but I am ok at animation. I ask a question:
How do I add more than one object to the 3D Carousel?
Say I have 9 images, each with the linkage "item1", "item2" etc...
how would I add them all into the carousel? and how would I make it so each only appears once?

View Replies !    View Related
Problem Changin Frames...
ok i have 4 instances of the same movies clip on screen, within that movie clip there is 4 difrrent frames, each having a diffrent picture on themand a stop action.

on the maintime line i have the following code...

mcs = [box, box1, box2, box3];
mcController = {};
mcController.changeFrames = function() {
mcs.sort(function () { return Math.random()>.5;});
for (i=0; i<mcs.length; i++) {
mcs[i].gotoAndStop(i);
}
};
imageChange = setInterval(mcController, "changeFrames", 1000);

now this should randomly show a certain frame every 1 second although its only showing frames 1, 2, and 3 but NOT frame 4.... can u see the problem ???

Thanx

View Replies !    View Related
Changin Properties In A Function
I want to set up this function where I can change it to scale _height, _widht or _x. But what Sintax do I use... I tried doing... this[myProperty]-whatever but it wasnt' working for me. I was then calling it like this...

this.myFunctionName("._height")

Here is the actual function I have been working on.

MovieClip.prototype.scaler = function(wDest, name) {
deltaX = Math.round(this._height-wDest);
dist = Math.round(Math.sqrt((deltaX*deltaX)));
if (dist>=5) {
if (this._height != wDest) {
this._height += (wDest-this._height)*.4;
}
} else {
//eval("this._parent." add name).go = true;
//myEval = true;
this.go=false
this._parent[name].go=true
this._height = wDest;
}
};

Thanks

View Replies !    View Related
Chameleon Text... Changin On The Go
Hello all,

I would like to have some text appear in one colour, but as it crosses a boundary it changes colour... can you please help??

Many thanks...

Haider

View Replies !    View Related
Changin An Object's Properties
Okay suppose you have a car as an object. You can click on different sqaures(as buttons) and depending on the color of the square, it will change the color of the car? How do you make the button change the color of the car?

I allready know that I have to draw out the
"paint" and make it an object, I just need to know how to make that button change the properties(color) of that object.

View Replies !    View Related
Changin TextArea Components?
Hi,

I wonder if anyone out there can tell me how to customise a Text Area component in MX2004Pro so that the border or the background can become transparent, without losing tyhe scrollbars? I have managed to affect both using actionscript but this also messes with the visibility of the scrollbar.

Thankyou

N

View Replies !    View Related
Changin Size Of Document
I have put togther 5 scenes at teh 554x440px and just changed the document to 1284x1024px ...the images etc i have used have not automatically resized...will i need to do this manually or is there a default button somewhere which will update the presentation?

View Replies !    View Related
HELP Problem With Changin SetInterval
Hi,
I am quite new to actionscripting - using flash 8

I am making a flash game. The object of the flash game is to use the mouse and dodge the beer bubbles.

to start with, the beer bubbles are released slowly, after 10 seconds i want the interval to decrease and the amount of beer bubbles to increase. my code is as follows:

if (cTime <= 10000){
setInterval (makeNewClipB, 1000);
}

if (cTime >= 10000){
setInterval (makeNewClipB, 500);
}

However, regardless of what the timer is at the bubbles are released at 500ms-

not sure if the method i am generate the bubbles has anything to do with it:

function makeNewClipB() {
clearInterval(ranID);
ran = (Math.random()*2000)+1000;
ranID = setInterval(makeNewClipB, 1000);
newClip = _root.attachMovie('bubble', 'bubble'+depth, depth++);
allBubblesB.push(newClip);
newClip._x = Math.random()*Stage.width;
newClip._y = 400;
newClip.speed = (Math.random()*10)+5;
newClip.onEnterFrame = function() {
this._y -= this.speed;
};
}

If someone can oint me in the right direction to get this working i would be very appreciative - i am starting to go mental

my .fla is here www.people.aapt.net.au/martinkyla/gamev2.fla

Many Thanks

Tom

View Replies !    View Related
Changin Movies Using A Listbox
Sorry folks. Forgot to include the link:

http://www.geocities.com/mac_1232000/listBoxIssue.htm

hi folks,

i'm trying to setup a listbox conatining a list of movies. what i would like to do is click on a movie name in the list box and change the movie in the container on the stage.

i've had a go but no luck and im starting to get mad!!

please help!

i have have included a link to a page which has the .fla file (apparently too big to post here) of my efforts so far (please dont laugh at my actionscript!!)

many thanks,

chukzuluhttp://www.geocities.com/mac_1232000/listBoxIssue.htm

View Replies !    View Related
Changin Font Size On The Fly
I was working on a way to allow users to change the font size for all the words by clicking a button in my flash movie so I've come up with this line:

on (press) {
dropdownmov.var4 = font face=Arial size=12> var4 /font;

}

I was trying to get the html formatting applied to var4 and then saved as dropdownmov.var4 to make the text size increase. I've been looking for a way to allow the user to increase the font size and so far this is the only idea I'm getting after looking everywhere trying to find some function and trying other functions as well. I know you can modify Flash UI component text size and what not with some commands, but I haven't seen anything neat for applying changes to text boxes in realtime. I had to take out the quotations and the <> from the piece of code I gave to make the whole line display on the message board, so just ignore the absence.

View Replies !    View Related
Changin Movies Using A Listbox
Sorry folks. Forgot to include the link:

http://www.geocities.com/mac_1232000/listBoxIssue.htm

hi folks,

i'm trying to setup a listbox conatining a list of movies. what i would like to do is click on a movie name in the list box and change the movie in the container on the stage.

i've had a go but no luck and im starting to get mad!!

please help!

i have have included a link to a page which has the .fla file (apparently too big to post here) of my efforts so far (please dont laugh at my actionscript!!)

many thanks,

chukzuluhttp://www.geocities.com/mac_1232000/listBoxIssue.htm

View Replies !    View Related
Changin Combobox Over Skin
Ok I have went through the flash help files and some tutorials, as the skinning video is not back online, and I am having problems with skinning.

I have created a combo box and I have worked out how to change the look of my buttons but I cannont find how to change the color of the green standard halo roll over. I want to make it a blue colour.

Can annone help, I couldnt find anything on the forum search either.

View Replies !    View Related
Create A Button At Runtime
thaks for help me at my last tread...

but a know i've an other problem...

how can i create a button into a movie clip created at runtime??

tahks

View Replies !    View Related
Changin' Input Text In A Movie
I need some help.
If a write a text in an input field, can I capture it in another box like a movie clip?

View Replies !    View Related
Changin Stage Background Colour
Hi,
I am working with flash mx and have created a movie that dynamically loads in images (.jpgs) using functions. I would like to create a few different slideshow themes and so would like to on individual frames use the dynamic movie clip to load in external files but would like to change the background colour for each to accent the changing theme of images.

What way using actionscript could i dynamically change the background colour of the stage.

Is this possible can someone help.

Cheers

View Replies !    View Related
Changin XML NodeName Type...heeelp
I was trying to push nodeNames into an array or directly use them as button names so I can use onRelease event but nodeNames are strings and buttons do not work if I say something like

nodeName[i].onRelease = function(){
}

how can I use nodeNames as instance names?

Thanks...

View Replies !    View Related
Changing The Text Of A Button At Runtime
Hi,

I want to make a button with text within it wich I can change at runtime using actionscript. I've tried this...

1) I created a new symbol (button) called 'abutton'
2) In this button I created dynamic text called 'somewords'
3) I used the button in my animation calling it 'mybutton'

I thought I could change the text with...

mybutton.somewords.text = 'example';


... but this doesn't work

Can anyone help please?
Thanks!

Paul

View Replies !    View Related
Change Textfield On BUTTON At Runtime
I have a movieclip in my symbol library named "sButton", inside this symbol there is a textfield named "tLabel".
when I attach this clip at runtime...
this.attachMovie("sButton", "mcNew", this.getNextHighestDepth());
... I am able to change the label inside the movieclip with...
this.mcNew.tLabel.text = "some new label text";

Now when I change the symbol type from 'movieclip' to 'button', I can't change the textfield contents anymore... the compiler accepts the code, but at runtiime the textfield is not changed. Is there a way to address the elements of a button symbol at runtime

Thanks,

P

View Replies !    View Related
Access A Button Label At Runtime
i am new to flash and it may sound stupid:
but I cannot find any property which allows me to set the label of a button at runtime.
What is the name of this property??
Markus

View Replies !    View Related
MC Buttons - Must Wait SoundComplete B4 Changin Frames?
I have the following code to play a specific mp3, then after it an mp3 in an array:

onClipEvent(mouseUp){
if(this.hitTest(_root._xmouse,_root._ymouse)){
this.pressed=true;
_global.LIZARDPRE = new Sound();
_global.LIZARDPRE.loadSound("ThatsMy__.mp3", true);
_global.LIZARDPRE.onSoundComplete = function() {
//the next line plays one mp3 from LIZARDARRAY
_global.LIZARDSOUND.start();
_global.LIZARDSOUND.onSoundComplete = function() {
_root.gotoAndStop(42);
}
}}}

as you can see, the code goes on movie clips Im using as buttons - but the frame they are on is reached by clicking a regular button on a different frame, so that you click and hold on one page, and let go over a movie clip with the code above on it on another, and it plays both mp3s -

you see the onSoundComplete code at the end telling playhead to go to (42) - on frame 42 I have this code:

MainText1.text=""
MainText1.text=LIZARDARRAY[(now++)%LIZARDARRAY.length] + ", " + LIZARDARRAY[(now++)%LIZARDARRAY.length];
now--;
now--;
gotoAndStop(2);

The problem is that I cant have the code on frame 42 in with the code for the movie button - it will only play the first mp3, but not the one from the array

Problem 2 is that I cant seem to find a way to have the second mp3 - the one from the array - play as the playhead goes back to frame 2 - I have to have the onSoundComplete in there for some reason - is there any way around that?

I'd like to be able to:

1. play both mp3s
2. have all the code on one movie button
3. not have to wait for onSoundComplete before going back to frame 2
4. retain the onRelease functionality for the movie clip buttons

What am I doing wrong?
Hope I didn't give too much/not enough detail.

View Replies !    View Related
Changin The Video Display Components Color
I dragged a "MediaPlayback" component onto the stage, gave it an instance name of "myVideo" and put this actionscript into the first frame:


ActionScript Code:
myVideo.setStyle("backgroundColor","0xFFCC00"); myVideo.setStyle("borderColor","0xFFCC00"); myVideo.setStyle("buttonColor","0xFFCC00"); myVideo.setStyle("color","0xFFCC00"); myVideo.setStyle("highlightColor","0xFFCC00"); myVideo.setStyle("scrollTrackColor","0xFFCC00"); myVideo.setStyle("shadowColor","0xFFCC00"); myVideo.setStyle("symbolBackgroundColor","0xFFCC00");


Still green......

View Replies !    View Related
Changin The Video Display Components Color
I dragged a "MediaPlayback" component onto the stage, gave it an instance name of "myVideo" and put this actionscript into the first frame:


ActionScript Code:
myVideo.setStyle("backgroundColor","0xFFCC00"); myVideo.setStyle("borderColor","0xFFCC00"); myVideo.setStyle("buttonColor","0xFFCC00"); myVideo.setStyle("color","0xFFCC00"); myVideo.setStyle("highlightColor","0xFFCC00"); myVideo.setStyle("scrollTrackColor","0xFFCC00"); myVideo.setStyle("shadowColor","0xFFCC00"); myVideo.setStyle("symbolBackgroundColor","0xFFCC00");


Still green......

View Replies !    View Related
Global TAB Button
hi, how can i disable the tabbing on my project... say i have a big project with lots of MCs, textfields and buttons.... i want that on entire the project there is no TAB functions.. no automatic tab ordering or whatever... i just dont want the tab function.

thanks

View Replies !    View Related
How To Change Button Label Color In Runtime
i want to change Label color to button which are placed in one movieclip.

View Replies !    View Related
GetURL Fails On Runtime Library Button
After years of estrangement, I'm embracing Flash once again. I have a little project I'm working on, but have faltered right out of the gate...

I created a shared library with a single, relatively simple button with a clip in the over frame. For the button symbol, in Linkage I chose:
Export for runtime sharing
Export in first frame
URL: shared_lib.swf

I published the library, then closed the .fla. I created a new test.fla and chose "Open External Library" and surfed to the shared_lib.swf.

The shared library opened as it should, with my simple button available. I dragged the button to the stage of the new test.fla, then checked its properties. Sure enough, "import for runtime sharing" was selected. I tested the movie, and the button (and its rollover clip) worked perfectly.

Here's where it fails. I assigned an action to the button
on (release) {
getURL("

View Replies !    View Related
Global Button Template
I am trying to make a button symbol that I can base all of my buttons on so that when I change the master button, those changes will be reflected across all of the buttons based on it - a gloablly changeable button template.

I've been thinking about how to do this and what I've come up with so far has not worked...

attachMovie
I thought that I could create a button that has a blank movie clip (MC) for each button state (up, over, down). Each of those "placeholder" MC's would have a different instance name. Then, wherever I needed a button I could place my "global button" instance on stage, give it a unique name and use an attachMovie frame action to assign pre-made MC's (an image saved as an mc) from the library to each button state placeholder within the button.

This would allow me to easily update buttons in the movie by just editing the attachMovie assignments.

Unfortunatley, it appears that attachMovie does not work within a button.

onClipEvent
Then I thought that since I know attachMovie works within an MC, I could just make a (3) frame MC and assign the onRollOver, onMouseDown and onRelease actions to it. I could use my initial thought to globally change the button states via attachMovie and just rely on onClipEvents to get the button functionality.

Unfortunatley, I've never used onClipEvents before and they seem a bit intimidating - creating functions, methods for objects? This is not something I'm familiar with and my original intention was to save time in creating hundreds of buttons by spending some extra time creating this global button. I'm not sure if this would yield the desired result.

Does anyone have an idea of how to accomplish what I'm trying to do - create a globally changeable button template? Is the onClipEvent method I describe above my best bet? If so, could anyone give me some pointers on where to start?

Thanks much for any assistance.

View Replies !    View Related
Global Button Animation (like CSS)
Hello All,

I have to create a map for a mall where the user can mouse over a store and it will animate. The thing is, I have upwards of 120 some stores that have the same animation.

Is there any way to create an animation, that will apply to all the buttons like you do with CSS? I would really like to try and avoid animating every button if possible, especially since the animation might be changed later.

Thanks,

Jeff

View Replies !    View Related
Changing A Global Value From A Button UI
I have this script in frame 1:

ActionScript Code:
// Stop the movie
stop();

// Global counter of points
var puntos;

// Flash button UI to go to another frame
function Button_onClick() {
    gotoAndPlay(5);

}
I have this code in frame 5:

ActionScript Code:
// Stop the movie
stop();

// Somewhere
_root.puntos += 10;
trace("Current: " + _root.puntos); // this shows correctly

// Reset the value counter
function Button3_onClick() {
    _root.puntos = 0;
    trace(_root.puntos); // Still shows the current value of puntos???
}
My problem is that in Button3_onClick handler calls correctly the trace, but the global puntos doesn't reset..any ideas? Actually I can't change nothing in my escene from the handler...its like a readonly state or something?

View Replies !    View Related
Can I Make A Global Button?
Hi !
I have some menu buttons in my main timeline. The buttons are really button symbols inside movie clips, then the "mc" is placed in the main timeline, so when I roll over them a movie plays. What I want is that when I press one button, it makes another play its own "mc" but I can't get the button symbols to talk to each other.

can I make global buttons. If I can how do I do this?

View Replies !    View Related
Global Back Button
Hi,

I need to program a global back button in a offline presentation. Presentation have numbers of scenes and frames. I want go back to previous stopped frame.

I dont have any flash scripting knowledge. I am using flash 8.

Pritam

View Replies !    View Related
Can I Attach Code To Button Imported For Runtime Sharing?
had another question on importing objects for runtime sharing.

i've imported into tier2.swf a button that is exported from another swf called tier1.swf (in the same folder). i've attached some code directly to the button in tier2.swf (selected the button, hit F9, and insert some on (release) code), but the code seems to have no effect.

if i name the button "myButton" and attach code to it from my Actions layer...

myButton.onRelease = function () {
//do something
};

...then everything works. why is that? why can't i attach code directly to an imported object?

thanks.

View Replies !    View Related
Global Variable From A Button Click?
I'm creating a dynamic menu and need to know:

If I set the contents of a global variable upon clicking a button on the main timeline, for example...

on (release) {
myVar = "someValue";
}

...and need to access the contents of this variable from a frame in a MC, how do I do this? It doesn't seem to work when I use...

if (myVar = someValue) {
gotoAndPlay ("play");
}

...in the MC frame actions. Any suggestions?

View Replies !    View Related
How Do You Create A Global Sound Off/on Button?
I have a fairly long Flash movie (7 minutes). It has a very long main timeline which contains a single "event" looping sound. The main timeline also has several "streaming" sounds.

At different points in the main timeline, I'm calling external Movie Clips. Each external Movie Clip has it's own "streaming" sounds.

It seems that the sound on/off button I came up with only turns off the sound for the currently playing sound, but once the playhead gets to a new sound, it will play it. Also, when I click my sound on button, it doens't pickup where it left off with the "streaming sound" and it also doens't start up my single "event" looping sound.

This seems like it would be a pretty simply thing to create. What am I missing here?

Any help would be super-appreciated.

View Replies !    View Related
Global Frame Actionscript For A Button
I have named a button on my stage - btn1 - in the instance name field.

I will apply actions to this button in a frame script.

I'm wondering if there is a way to make this frame script global to every instance of the button in my flash movie, so that I don't need to re-apply the script in a keyframe everytime there is a new keyframe in my button's layer.

PS - The button will only be used on the main timeline of my flash movie, but does have separate keyframes.

Thanks!

-Foochuck

View Replies !    View Related
Button: Saving Value Into A Global Variable
if I attach the more or less the following code to a button:

on(release)
{_global.myvariable = _global.myvariable + 3;
gotoAndPlay(x);
}

Why doesn't it save the value 3 into the global variable? Isn't it supposed to do so? How can I accomplish it.

View Replies !    View Related
Global Play And Pause Button?
I have 2 buttons (play and pause)...on my main movie.
I would like for these 2 buttons to play and pause entire movie (different flash movies into 1).

on my play button i have mc = playbutton
and the as for this is the following:

ActionScript Code:
on (release) { play(); _root.pause._visible = true; _root.playbutton._visible = false;}


on my pause button I have mc = pause
and the as for this is the following:

ActionScript Code:
on (release) { stop(); _root.playbutton._visible = true; _root.pause._visible = false;}


on my 1st frame of my main movie I have the following as:

ActionScript Code:
stop();_root.playbutton._visible = true;_root.pause._visible = false;


my problem is that when I upload this... and test it, its not working. I also tried by removing _root. to it, but it didn't work either. I need other .swf's to pause and play too when its called from the main movie where the buttons are.

anyone please help.

View Replies !    View Related
Using For-if To Create A Global Pause Button?
Hello everyone!

I need to create a global pause button that can pause everything, including all MCs, and then start them up again.

It looks like for-in will give me the ability to determine what MCs I have loaded at the time, but I'm not sure how to approach this.

I already have a CD-ROM presentation created which loads separate SWF files & each SWF has multiple MCs inside of it. I need a pause button that can determine what movie clips are available and allow me to pause everything and restart it.

Any thoughts?

Thanks!

Paul

View Replies !    View Related
How Do You Create A Global Pause/start Button?
I have a long 6.5 minute sales demo that needs a button that will allow the user to pause the entire Flash movie, and then hit it again to resume playing from where it left off. It seems simple, but my solution didn't work.

Any suggestions?

Thanks in advance,
Joseph

View Replies !    View Related
Global Function For Button...something Not Working Quit Right....
OK. I have a movie with 7 scenes. The issue I am having is that a button, contained within a movie clip in one scene (scene X) will not allow users to access any other scene.

On click, it should go from scene X to scene Y, but I am not able to get this to work if the button is contained within a movie clip.

The code is as follows:

on (release) {
gotoAndPlay("scene Y", 1);
}

Any assistance would be much appreciated.

View Replies !    View Related
Global Click Sound For Button Component
Ok, this sould be really simple, but I have having problems. All that I want to do is assign a sound to play when a button component "clicks". I can assign a click to a specific button istance, but I am having a problem assigning the click sound to all instances of any Button Object in the movie.

I am assigning a global class to all Button Objects that controlls the font, color, size, etc. But no luck with assigning a sound, or for that matter getting any event to run everytime any button is "clicked". I have dozens of buttons in the movie, and it would be Much cleaner to just assign a global sound ...

There should be a way to assign a listener to the Button Component Object. Like:


Code:
Button.click = function () {
trace ("some button was clicked");
};
//where Button is the reserved key word for the button object

any ideas?

thanks

--mm

View Replies !    View Related
Global Mute Button For FLVPlayback Component
I am building an e-learning course that uses audio voiceover. Each page of the course begins with the voiceover playing. The user can stop, start, or pause the voiceover. There may be one or more voiceover instances per page depending on page length or if other activities are present. All-in-all, there will be about 80 separate FLV audio voiceovers used throughout the course. Each page of the course is an html page (about 40 total), and each voiceover FLV is embedded/called individually.

As the voiceover is turned on by default, some users would rather take the course without sound. Instead of making the user stop or start each voiceover instance, I would like to add a global mute-button. This button needs to communicate across all voiceover instances setting the volume to mute=on/off. This way, the user only needs to press one button to turn all audio on or off throughout the course as desired.

I see there is a mute button available in the Flash 8 FLVPlayback component options. How do I script this button to talk globally to other FLV voiceover instances and solve the problem mentioned above?

-Psiseeker

View Replies !    View Related
Global Mute Button For Multiple Voiceovers
I am building a flash presentation that uses audio voiceovers and background music. Each section has it's own animation and voice over. The action script stops the animation from going to the next section until the VO for the current section has finished playing. There are 12 different animation sections and 12 voiceovers all on one timeline, not the root timeline. Each section is it's own movie clip and includes the VO.

I put a global mute button on the root timeline and it will mute the VO for the section that is currently playing but when it goes to the next section the sound comes back on.

How do I write the script so the global mute button will mute all the VOs at one time and so the user doesn't have to click the mute button at the begining or every section?

New to scripting and can't figure this out.

View Replies !    View Related
Radio Button Global Variable Problem
I made a form that has global variables to hold input text that later reappears in my flash movie.
I am having trouble getting radio buttons to hold their values for later viewing.
Any ideas?

View Replies !    View Related
Several Button Instances, Same Url, Need Global Piece Of Actionscript
I have a button that appears in several places within my flash file. They all link to the same URL. I'd like to put just one piece of action script for "get URL" that will apply to all instances of the button. Can this be done? Thanks

UsingFlash 8

View Replies !    View Related
Increment A Global Variable One Button Press At A Time?
what I am trying to do is use a Switch index to controll movie clips
with a button to advance to the next case: statement and when I have reached the end
of the case: index go back to the case: 0; and start all over again.

what I need is a global variable and give it a value of 0
var clipsVariable:int = 0;
var goalreset:int = 10;

function onClick(event:MouseEvent):void{

is clipsVariable < goalrest

clipsVariable = 0;
else
add 1 to clipsVarable
call switch ();
}

I seem to have the somthing scrood up because the switch does not see the clipsVariable
and so go into an endless loop any ideas?

View Replies !    View Related
[F8] Possible To Set Runtime Sharing Path At... Runtime?
After a weekend of pulling my hair out on this problem it looks like the paths for runtime sharing are relative to the HTML page, not the SWF. This is a problem because the client wants to be carefree in distributing the SWFs around the server. (In fact is demanding it.) So I need a way to set the runtime sharing path at runtime.

Or put another way...
"child.swf" is looking for fonts and graphics in "master.swf" If I move them all (including "master.swf") to some/random/folder/ and embed them from a HTML page at /a/different/folder/ the linkage breaks, even though the files load fine. (The paths to the SWFs are sent via XML.)

Any ideas? I really can't hard-code this and I probably can't compile new versions each time they feel like moving stuff around.

Worst case I'll skip the runtime sharing, but it would make the files needlessly big and slow.

(Publishing to Flash 8 AS2)

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved