Dynamic Buttons
Hello,
Does anybody have a tutorial on dynamic buttons. I want to be able to dynamically update the label of button, and give it an instance name, and also I want to be able to refer to each button's name and use it for whatever...
any help??
Thanks
FlashKit > Flash Help > Flash ActionScript
Posted on: 08-25-2005, 03:57 PM
View Complete Forum Thread with Replies
Sponsored Links:
Dynamic Text For Multiple Buttons W/ Scroll Buttons/bar
HELP! I know a similar question to this has appeared multiple times before, but here is my situation:
i have four buttons, each of which will load a a separate text file into a dynamic text field (ie: button A to textfield 1, button B to textfield 1).
The other trick is, this also has a custom scroll bar. (I would rather just use an up and down arrow, but if i have to use a bar as well, I will not be too distraught.)
Is there a way that I can have all the text files loads in a dynamic text field PLUS have a scroll bar to aid with scrolling.
Any help would be greatly appriciated. I have been trying to figure this out for about a week now, and am still no where.
peter /slqu.net
ps: i am a designer, and for some reason, programming, even of the most simple nature, still eludes me. so please take pity me
View Replies !
View Related
[F8]Buttons, Buttons, Buttons Dynamic Text?
Hi
I've got a set buttons that are different instances of the same mc. I'd like to make labels for each button but I don't want to have to duplicate all the buttons in the library and add the labels separately.
I think I need to to this with Dynamic text but that as far as I've got with the searches I've done on Google.
Thanks in advance for any help.
View Replies !
View Related
XML Loading, Dynamic Buttons, Dynamic Text Fields...
My last thread kind of died, I guess, so here's another one that I hope will get me some help; it has an updated FLA attached and what I think to be some better descriptions of my problems... I know I'm totally indebted to whomever will help, but this is an emergency and I need some timely advice.
so here's the FLA, XML, and some sample images: kirupaTest2.zip
1. I pretty much have the enlarged pictures loading I guess, which was my major problem before, but it doesn't matter because I can't get the code to "know" which of the dynamic thumbnails has been clicked (by "know", I mean return an index value, say 0 through 7 if there are 8 projects, that I can use to access that particular project in the array of 8 projects in the rest of the code)... So if the third movieclip thumbnail were clicked, I'd like "2" to come up somehow... I've tried this code, which is kind of lame, I know, based off of the idea of each of the thumbnail movieclips' names ending in their index number:
ActionScript Code:
//"this" is the button that was pressed; would return a string ending in//thumberMC_<number of whichever movieclip thumb was clicked>var: testString:String = this; //storing how many characters are in the string above...var: stringNumb:Number = testString.length;//using that value to take off the last string (hopefully the number)var: finalString = testString.charAt(stringNumb);
And that didn't work. (The code above was entered around line 71 in the layer "actions"; it's gone now)
2. An even bigger problem is I have some containers being drawn dynamically from height and width values pulled from an XML file. When I test the code that creates the objects using hard-coded values, it works fine; say if I put 481 in for the width and 375 for the height. But if I try to do it (sort of) dynamically like:
ActionScript Code:
var picHeight:Number = projects[5].bigPics[0].picHeightvar picWidth:Number = projects[5].bigPics[0].picWidth
it gets all screwed up; please try it for yourself in the supplied FLA. It's hard to describe what goes wrong; some things are drawn, and others aren't. I think it's because the objects are trying to draw before they have the data to draw with. This can be seen at lines 129 and 130.
3. Lastly, there's a dynamic textfield I'm trying to create that never shows up for some reason. Again, you could see in the FLA (in the "createDrawer" function around line 424).
If I can clarify, please let me know.
View Replies !
View Related
Dynamic Buttons For A Dynamic Menu - Flash_8
Hello,
I have to prepare a dynamic menu in actionscript that read the name of the button and the colour from a database in Mysql. I used amfphp to achieve the last part.
I would like to generate the button with the text and its colour get from the database. (The background of the button is gray, there is a little vectorial logo and a text that should be of the given colour, i.e. a gray button with the green logo and the green text, a gray button with the red logo and the red text, and so on).
The rollover should be of the same colour of the text, but the logo and text should become white.
Is it possible to create a movie I could change colour parameters (for text, vectorial logo and rollover)? Or may I create the button from scratch using entirely actionscript? Is there a guide or a tutorial for that?
Thank you in advance for all your help!
View Replies !
View Related
Creating Dynamic Buttons With Dynamic Behaviours...
Hi!
I am creating dynamic buttons with a instruccion like this:
Code:
for (i=0; i<25; i++) {
_root['room'+i+'_btn'].onRollOver = function() {
trace ("color:"+i)
};
I want every button says a different number. ej: if u push the button 12 (i=12) it says "color:12"
With the code i created it always says "color:24"
any idea???
Thanks!!
View Replies !
View Related
Buttons In Dynamic Txt
hi all
does anybody know if it is posable to create buttons in dynamic txt box using actionscript. i've got a client list and each client has a bio page which i need to click to.
any help would be good
regards
steve
View Replies !
View Related
Dynamic Buttons
I'm trying to create a menu system with buttons. Depending on the value of an external variable, either 3 or 4 buttons must be displayed, sized and positioned.
Each button must be overlaid with dynamic text and as each (visible) button is clicked, the timeline must jump to a particular frame.
I have tried using movie clips but cannot get the clip to respond to a mouse click.
Any help would be appreciated.
John
View Replies !
View Related
Dynamic Buttons
Hi guys,
ok I want to load url links from a text file and dynamically create the buttons for those links in flash
TextFile :::
totalbuttons=4&site1=http://www.webpage.com&site1label=webpage&site2=......... ...etc
Flash Code Frame 1 ::::
loadVariablesNum ("text.txt", 0);
Flash Code Frame 2 ::::
i = 0;
y = 40;
do {
duplicateMovieClip (butt, "butt"+i, i);
setProperty ("butt"+i, _y, (getProperty("butt"+i, _y)+ y));
setProperty ("butt"+i, _x, 225);
setProperty ("butt"+i, _name, "site" + i);
i = i+1;
y = y + 80;
} while (i < totalbuttons);
stop ();
Code on 'butt' movie ::::
on (release) {
getURL ((getproperty(this,_name)), "_blank");
}
---------------------------------------------------------
this should basically work except for the fact that flash wont recognise that "site" + i is a variable name and sees it only as a string.
If anyone knows a way around this little problem in flash please let me know.
cheers
View Replies !
View Related
Dynamic Buttons/XML
Ok, I'll try to make this comprehensible, although it's pretty complicated...
I'm loading XML into a SWF that causes a variable number of song titles to display - could be 2, could be 200. When you click a title, a sub-content area in the same SWF has to load the lyrics for that song.
My problem is: since each title will have to be a button, how can I set the OnClick action within that button - which will be created dynamically - to pass the ID of the song into the sub-content area so it can find the right lyrics???
This is slightly simplified, but a good answer could solve all of my problems. Is this even possible?
View Replies !
View Related
Dynamic Buttons?
What I'm trying to build is a photos section, where you click on a date and it loads an external swf full of images into a Scroll Pane. But what I'd like is to have a dynamically created list of buttons for each date, where I update a text file with the new date and swf. Any help with this is appreciated.
View Replies !
View Related
Dynamic Buttons From XML
I'm duplicating movieclips with buttons inside them. I want the buttons to be assigned a dynamic getURL based on a value from XML. Does anyone know of or have a solution for this before I reinvent the wheel?
Here's what I've come up with so far:
Code:
// Do duplication of movieclip with button on its timeline
yourMovie.duplicateMovieClip("movie"+cClipCount, aNumber);
for (i=0; i<=anArray.length; i++) {
// Assign an action dynamically to the button inside the movieclip with a handler??
this["movie"+cClipCount].onRelease = function() {
loadMovie("images/" + fileName[i] + ".jpg", _root.JPGtarget);
}
}
View Replies !
View Related
Dynamic Buttons
Hello everyone,
I am working on a project which I need to get a list of products from a datbase and dynamicly create the buttons spaced out and the product name and link attached...
I am using flash mx... and a php mysql backend
can anyone give me a simple example of the code to make this work
thanks
sssnnn
View Replies !
View Related
Dynamic Buttons HELP
HELP!
I've created a movie that uses a "#INCLUDE ..." file to generate my menus. Well my buttons are created wonderfully thanks to good ol' "duplicateMovieClip". Unfortunately, I can't figure out how to create a link for each button (ex: on (release) {...}) individually. Can I use paths inside an "on" event statement or is there a better way. Here is a protion of my include file:
//Title first button
_root.topnavBut.buttext = "produce";
//Gather it's location properties
butx = getProperty(_root.topnavBut, _x);
buty = getProperty(_root.topnavBut, _y);
//Create second button
duplicateMovieClip (_root.topnavBut, "topnavBut2", 9);
setProperty ("topnavBut2", _x, butx + 140);
setProperty ("topnavBut2", _y, buty);
_root.topnavBut2.buttext = "meats & seafood";
butx2 = getProperty(_root.topnavBut2, _x);
buty2 = getProperty(_root.topnavBut2, _y);
//Create third button
duplicateMovieClip (_root.topnavBut2, "topnavBut3", 10);
setProperty ("topnavBut3", _x, butx2 + 140);
setProperty ("topnavBut3", _y, buty2);
_root.topnavBut3.buttext = "prepared foods";
butx3 = getProperty(_root.topnavBut3, _x);
buty3 = getProperty(_root.topnavBut3, _y);
etc. etc. etc.
Thanks
View Replies !
View Related
Dynamic Buttons
is there a simple actionscript for creating a dynamic button? i have dynamic movie clips that I am dropping on the stage and then adding text to:
Code:
_root.createEmptyMovieClip("mc", 1);
for(i=1; i<31; i++) {
_root.mc.createTextField(["t"+i], i, 15, place, 840, 20);
}
i'd like to somehow make that text, a button with a rollover state and a nice onrelease { var nice = (dynamic button name); } kinda thing.. does actionscript support this in anyway? the caveat is that i'm passing button name to the flash along with t1.text=value.
dross
View Replies !
View Related
Dynamic Buttons
Please please help! this MX problem is driving me mad!
I'm creating dynamic buttons, based on a movieclip called mybuttonclip
each mybuttonclip contains a textbox, with the variable name of buttontext.
I have a function that creates the button, the function is supplied with a number between 0 - 8 and a name (ie "click me")
the problem is that I can't get the names to appear on the buttons.
I've popped the code below, can someone tell me what I'm doing wrong?
function createButtonClip(strName, intButtonNo) {
// duplicate clip
strThisClip = "buttonclip"+intButtonNo;
duplicateMovieClip(_root.mybuttonclip, strThisClip, intButtonNo);
// pop it in the right place
righty = 30+(24*intButtonNo);
setProperty(strThisClip, _x, 1);
setProperty(strThisClip, _y, righty);
//all works so far!! here's the dodgy bit.......
strThisClip.buttontext = strName;
}
View Replies !
View Related
Dynamic Buttons
Hi
I am trying to get my movie to dynamically load sets of images 8 cols by 3 rows and then dynamically load buttons over those images and depending on which button gets clicked it calls some internal popup window etc... so if my BtnWheel is the invisible button placed over the image I did this
//row looop
for(i=0;i<4;i++)
{ //column loop
for(j=0;j<9;j++)
{
//assign unique name
btnTMP= "btn" add i add j;
//trace(btnTMP);
duplicateMovieClip("btnWheel",btnTMP,i);
//move along x axis in current row
btnTMP.setProperty(_x, (_x-20));
}
//reset inner loop
j=0;
//go to next row
btnTMP.setProperty(btnTMP, _y, _y-30);
}
But it wont actually move the _x & _y position of current movie they all seem to be piled atop each other. Does anyone know how to control positioning of duplicated movies ??? _x-20 doesn't work so flash is not interpreting this I thought it would. If anyone knows a cleverer way of doing this sort of thing please let me know cause I got fair few images & buttons to load =))
Cheers
View Replies !
View Related
Dynamic Buttons?
Hi all
I'm placing buttons dynamically for a portfolio (with no problem). But when I try to place numbers dynamically into the buttons it doesn't work, when I call the buttons ( _root.navButtons["portButton"+i].buttnumber = i+1; ) I get nothing, but when I call the buttons ( _root.navButtons.buttnumber = i+1; ) I get 3 in all the buttons (which is the length of my Portfolio).
What I'm looking to get is 1, 2, 3...
Code:
<?xml version="1.0" encoding="UTF-8"?>
<Portfolio>
<Port portName="name01">
<PortNode jpegURL="images/portfolio01/Port01.jpg" />
<PortNode jpegURL="images/portfolio01/Port02.jpg" />
<PortNode jpegURL="images/portfolio01/Port03.jpg" />
<PortNode jpegURL="images/portfolio01/Port04.jpg" />
</Port>
<Port portName="name02">
<PortNode jpegURL="images/portfolio02/Port01.jpg" />
<PortNode jpegURL="images/portfolio02/Port02.jpg" />
<PortNode jpegURL="images/portfolio02/Port03.jpg" />
<PortNode jpegURL="images/portfolio02/Port04.jpg" />
</Port>
<Port portName="name03">
<PortNode jpegURL="images/portfolio03/Port01.jpg" />
<PortNode jpegURL="images/portfolio03/Port02.jpg" />
<PortNode jpegURL="images/portfolio03/Port03.jpg" />
<PortNode jpegURL="images/portfolio03/Port04.jpg" />
</Port>
</Portfolio>
code:
port_xml = new XML();
port_xml.onLoad = Start;
port_xml.load("xmls/portfolio01.xml");
port_xml.ignoreWhite = true;
// Show the first slide and intialize variables
function Start(success) {
if (success == true) {
rootNode = port_xml.firstChild;
portAmount = rootNode.childNodes.length;
for (i=0; i<portAmount; i++) {
_root.navButtons.attachMovie("portButton", "portButton"+i, i);
_root.navButtons["portButton"+i]._x = ((_root.navButtons["portButton"+i]._width+5)*i);
_root.navButtons["portButton"+i].buttnumber = i+1;
trace(_root.navButtons["portButton"+i].buttnumber);
}
}
}
This traces 1, 2, 3 but places 3 in all the buttons.
Thanks
Halcyon32
View Replies !
View Related
Dynamic Buttons
I'm not sure if this is the correct forum for this question, but here goes...
Flash version = MX
I want to create a series of buttons (5 to be exact) which control the position of 5 different images behind a mask.
Each button coresponds with an image, when a button is 'over' I need the images to smoothly scroll to the correct one.
eg; image3 is the one visable - brackets = mask:
image1 image2 (image3) image4 image5
button1
button2
button3
button4
button5
Mouse over button3. When moved to button5 (for example) image4 would scroll through to reveal image5...
image1 image2 image3 (image4) image5
image1 image2 image3 image4 (image5)
I hope this makes sense and someone can help, or at least point me in the direction of a suitable tutorial.
View Replies !
View Related
Dynamic Buttons
Hi All,
I need to keep this short and sweet so that i can go to bed and go to work tommorow, so please excuse me if i seem to go too fast.
I am currently working on a project that is due sometime by the end of this week, and everything is working fine, except for the ticker on the top of my page which is made using flash and actionsript.
I will ignore all the coding for the functions on how to get the lines to load from a text file and into the swf file and then marquee over the site as i belive this to be irrelevant.
Allong with the loading from a text file, my client would wish to be able to modify the number of lines, and what is on the lines. In other words, my client just opens up notepad, edits the text file, and the swf handles the rest.
My problem is as follows, as i said before, the marquee effect is working perfectly. However, my client also wishes to update links so that the marquee links to the pages acordingly.
I have managed to load the URL of the page into the program enough as to have the link work by using:
on(release){
trace(_root.url1);
getURL(_root.url1,"MAIN");
}
url1 being loaded from the textfile
&url1=http://www.mysitehere.com
this however only half solves my problem...
the code for the marquee sets a variable "j" and each line of text adds one to "j" making j = 0,1,2,3,4,5,6,7 etc... acordingly.
my guess is that i would need to set a variable called "addy" (or anything else) and make it equal whatever ("url" add j) is...
my guess would be to change the code to:
on(release){
trace(_root.addy);
getURL(_root.addy,"MAIN");
}
and make addy = ("url" add j)
obviously this only outputs "url1, url2, url3, url4 etc..." acordingly. so as simple as i know the solution is, i cant stop making "addy" output as "url1" instead of the adress itself.
hopefully i did not mumble on and on and i can receive some help.
Apreciate any input at all
Thank You
A Very Confuesed Psycho
View Replies !
View Related
Dynamic Buttons
Hi all.
I'm currently working on a project combining Flash MX, PHP and MySQL.
My problem is, I need to set the properties of buttons at run time but do not know how. Basically.....when records are returned into Flash from MySQL, I need buttons to represent each record, so that when clicked they will again query the db for that specific record (does that make sense?).
Any ideas or help will greatfully appreciated
Boo.
View Replies !
View Related
Dynamic Buttons
hi, I have a question regarding setting the actions of buttons. I have three buttons that control what information is shown in an MC with dynamic text fields AND it also controls the sliding menu in which it resides. I can't get both to work! Either it slides, but the information is not there, or vice versa. I can't post my fla because of our firewall, but here is one of the scripts from the mcs that control the buttons:
onClipEvent (enterFrame) {
this.onRollOver = function() {
_root.floater_MC.menu.prodTit = "NOCOLOK® CB Flux";
};
this.onRollOut = function() {
_root.floater_MC.menu.prodTit = "";
};
this.onPress = function() {
this.startDrag();
this.swapDepths(4);
};
this.onRelease = function() {
this.stopDrag();
this.swapDepths(4);
if (eval(_droptarget) == _root.floater_MC.menu.target_MC) {
this._x = _root.floater_MC.menu.target_MC._x;
this._y = _root.floater_MC.menu.target_MC._y;
this._rotation = 23;
this._xscale = 150;
this._yscale = 150;
_root.floater_MC.menu.prod_01._visible = true;
_root.floater_MC.menu.prod_01.prodCard_MC.cardTite l = "Flux";
_root.floater_MC.menu.prod_01.prodCard_MC.productL ist = "watch film Flux";
//button 1
_root.floater_MC.menu.panel_MC._visible = true;
_root.floater_MC.menu.foto_MC._visible = false;
_root.floater_MC.menu.prod_01.prodCard_MC.card1_bt n._visible = true;
_menu.prod_01.prodCard_MC.card1_btn.onRelease = function() {
if (out) {
out = false;
} else {
//set var
out = true;
}
};
//button 2
_root.floater_MC.menu.prod_01.prodCard_MC.card2_bt n._visible = false;
//button 3
_root.floater_MC.menu.prod_01.prodCard_MC.card3_bt n._visible = false;
} else {
this._x = 197;
this._y = 5.8;
this._xscale = 100;
this._yscale = 100;
this._rotation = 0;
_root.floater_MC.menu.prod_01._visible = false;
}
};
}
thanks! miakazi
View Replies !
View Related
Dynamic Buttons... Please Help.
I downloaded this movie from flash kit http://www.flashkit.com/movies/Scrip...8320/index.php ... And I am trying to center everything instead of aligning to the left. How do i build the button from the center and allow MC's on either end instead of just on the right move when the text gets bigger? Please Help... I have another movie i am working on if you want to see it... Thanks
View Replies !
View Related
Dynamic Buttons HELP
Hey all!
I'm working on a flash project that will display information about various buildings on a college campus. The movie I'm currently working on is the floorplan movie. Essentially what I have to do is have one .swf file that loads everything in from various xml files. It's supposed to display the floorplan for the floor that the user selected on the previous page and then allow the user to click their room from that floorplan. The problem is that, as I said, this is to be entirely one .swf that can load any floorplan from any building and allow the user to click on his/her room. I'm a bit baffled as to a good way to do this as each floorplan is different, has a different number of rooms in a different arrangement and the rooms aren't even uniformly sized. The goal is to have a neat little zoom effect for when you click on your room that will zoom into the floorplan of just that room.
The only way i've been able to come up with for doing this dynamically would be to make the entire area where the floorplan jpeg is loaded a button and then put in some actionscript so that when you click the mouse, it gets the x and y coords of the mouse and then runs a function to check which room those coords would be in based upon a table of coordinates brought in from the xml.
I really really want someone to tell me that there's a better way to do this. I'm not really interested in doing all the work that would be required for this method and in addition it kills the zoom plan. :-)
Thanks in advance for any suggestions!
PS: Ok after beating myself in the head with an old rusty shovel I found outside I've come up with another possibility. What if I were to create a set of generic movie clips. First I'd have to find out what all different types of rooms there were. Lets say there are 5 different shapes of rooms then I could create 5 different movie clips and each would contain a blank button that would have its "hit" region defined as the shape of whatever type of room it's representing. Then, at runtime when I read in the data from the xml I could just duplicate each movie clip the correct number of times and then move the buttons to the correct coordinates over top of the floorplan. I still wouldn't get the zooming effect but this would probably be somewhat easier than my earlier idea.
Anyone have any thoughts to share?!?
View Replies !
View Related
Dynamic Buttons
I'm having a hard time with this. I have several button that contain photos, I want to click on them and have them come to the front enlarged, but because of the layers, they seem to interfear. Enclosed is a fla file that contain these button. Can anyone help me out with it. Thanks
View Replies !
View Related
Dynamic Buttons
Hi, I don't know how to accomplish what I want to do and am hoping that someone here can help me. I have a scrolling text box deep within my (loaded) movie (5-6 levels down) which I would like to use as a menu. Because the menu contents will be constantly changing, however, I'd like to somehow load the menu text and the text's corresponding buttons into the scrolling text box. I don't have a problem with dynamically loading text into a textbox in flash (I'm using MX and MX2004, if that matters), but I'm wondering how to assign actionscript to certain portions of text. I know that it's possible to assign HTML links by selecting "Render Text as HTML" and using tags within the text file, but I've never done this (or heard of this being done) with actionscript. Each portion of text (or menu item) needs to have the following code attached to it:
on (release) {
_parent._parent._parent._parent._parent._parent._p arent._parent.gotoAndPlay("withtext");
}
on (release) {
_parent._parent._parent._parent._parent._parent._p arent._parent.text.loadText = new loadVars();
_parent._parent._parent._parent._parent._parent._p arent._parent.text.loadText.load("http://www.mywebsite.com/essays/textfile1.txt");
_parent._parent._parent._parent._parent._parent._p arent._parent.text.loadText.onLoad = function(success) {
if (success) {
_parent._parent._parent._parent._parent._parent._p arent._parent.text.scroller.html = true;
_parent._parent._parent._parent._parent._parent._p arent._parent.text.scroller.htmlText = this.essaytext;
}
};
}
"Textfile1.txt" would change for each button (i.e. the second button might need to load "textfile2," etc.). Can anyone help me out? Thanks for your time.
View Replies !
View Related
Dynamic Buttons
Hi, I posted parts of this question already and received partial answers. Thanks to those who tried to help me so far - joejoe and quince
FIRSTLY:
I'd like to have one button (button1) and 11 instances of that button. The instances should each have different text. This is the code suggested to me for that:
code: duplicateMovieClip("button1","button2",2);
duplicateMovieClip("button1","button3",3);
duplicateMovieClip("button1","button4",4);
button1.btext = "Button 1";
button2.btext = "Button 2";
button3.btext = "Button 3";
button4.btext = "Button 4";
(for 4 buttons)
SECONDLY:
I'd like the button (button1) to play a MC (box_growing) in it's over state. The MC is in 4 distinct parts. I'd like the button to play a different part depending on it's coordinates. This is the code suggested to me for that:
code: if (mymovieclip_mc._x >= 100 or mymovieclip_mc._x <= 200 and mymovieclip_mc._y >= 100 or mymovieclip_mc._y <= 200){....
----------------------
I've tried to implement both of these in the .fla i'm posting but could not get either to work.
The .fla is too big to attach (800kb) so you can get it
HERE
Thanks very much for any help!
View Replies !
View Related
Dynamic Buttons
I implimented kinda the same thing with my project but I am unable to get it to dynamically code onRelease actions into the newly made buttons
How do I make the onRelease values stick as something different after each button is made
when I trace it just makes all the buttons use the same stuff
PHP Code:
stop();
_global.endtrans = 0;
/// vars for loading thumbs and buttons
var picWidth:Number =35; //the width of pictures I use for this project
var numPic:Number =38; //number of picture I use
var i:Number = 0; //loop variable
var newHolder:MovieClip; //used to store duplicates of imageHolder_mc
var newX:Number; //used to keep last imageStrip_mc x value
var speed:Number; //image strip speed
maxButtons = 38;
nbrColumns = 15;
leftMargin = 11;
topMargin = 20;
cellWidth = 35;
cellHeight = 24;
// in this loop I create a rows and columns of pictures
// I have in a folder where my .swf file is
for (i;i<numPic;i++){
newHolder = this.imageStrip_mc.imageHolder_mc.duplicateMovieClip("imageHolder"+i+"_mc",i);
var cellX = i % nbrColumns;
var cellY = Math.floor(i / nbrColumns);
newHolder._x = leftMargin + cellX * cellWidth;
newHolder._y = topMargin + cellY * cellHeight;
newHolder.loadMovie("thumbs/tiny_"+i+".jpg");
};
//I need variable i to be 0 again because I use it again for another purpose
i=0;
///this loads buttons just like above
for (var i = 0; i < maxButtons; ++i)
{
duplicateMovieClip(this.myButton, "button_"+i,i+1);
var mc = eval("button_" + i);
var cellX = i % nbrColumns;
var cellY = Math.floor(i / nbrColumns);
mc._x = leftMargin + cellX * cellWidth;
mc._y = topMargin + cellY * cellHeight;
mc.onRelease = function() {
// here I tried setting a global and what is below
gotoAndStop(i+121);
trace(i);
}
}
_global.endtrans = 1;
For some reason the value will not sick how do i make a different onRelease function for each button that will actually hold the code.
View Replies !
View Related
Dynamic Buttons
hy,
i was wondering :
could it be possible to make references to buttons dynamic?
for example in a mp3 player playlist if the number of songs is not constant the i have to make the references of the maximum number of songs. Could it be possible to make a "for" loop to make the references to the buttons?
Thanks!
View Replies !
View Related
Dynamic Buttons
Hiya,
I'm new to flash and I'm trying to encorporate flash links in my website.
Could anyone tell me if it's possible to create flash links that are dynamic, e.g. on one occation the button's target link may be www.somewebsite.com?name=andy and on another occation it may be www.somewebsite.com?name=tom.
Thank you!
View Replies !
View Related
Dynamic Buttons - Help
I am brand new to actionscript and are trying to figure out how this works. I have 4 buttons on stage with instance names of btn_1, btn_2, btn_3, and btn_4. They have linkage ID's the same as instance names. I want to be able to send a number from HTML into flash, and display those particular numbers. If I send a 2, only button 1 & 2 will show. Please excuse this very basic question, I've just started learning actionscript 3 weeks ago.
I don't have any actionscript for the buttons yet. This is for an image zoom tool with 4 small buttons for alternate images...
this is what I have in the actions layer so far...
_root.image_holder.image.loadMovie(datasrc);
_root.image_holder.image._xscale = 50;
_root.image_holder.image._yscale = 50;
_root.image_holder._x = 264;
_root.image_holder._y = 250;
_root.image_holder._xscale = 100;
_root.image_holder._yscale = 100;
width_value = _root.image_holder._width;
height_value = _root.image_holder._height;
x_value = _root.image_holder._x;
y_value = _root.image_holder._y;
_root.zoom_upper_limit = 10;
_root.zoom_lower_limit = 0;
_root.zoom_state = 0;
//end root level code
stop();
Im just at a dead end and don't know where to being
View Replies !
View Related
Dynamic Buttons
Hi,
Can someone please direct me to a tutorial or movie example that dynamically creates links for buttons?
I'll ellaborate:
I have a flash file with buttons, but the links of the buttons need to be changed frequently as per client's requirements. Is there a way that the buttons' links are read from a notepad file (links.txt) so all they need to do is change the text file with their links? eg
1= home.aspx
&2=contacts.aspx
... and so on.. please help me or direct me as Im in urgent need for this.
Mubin
View Replies !
View Related
[F8] Dynamic Buttons
Hi,
I have a Flash map of the 50 states of the USA and its a pain to edit them. I was wondering if I could simply edit the actions dynamically using a loop (it should be possible but every website I have seen said that its not for buttons) and possibly dynamically change the content. Right now I have a loop like so:
Code:
for (i in this) {
if (this[i] instanceof Button) {
statename = this[i]._name;
statename.onRelease = function() {
trace(statename + ".onRelease");
};
trace(this[i]._name);
}
}
But of course statename is undefined. I know what the state names will be ahead of time so instead of changing all the instance names for my buttons, can I just make an array and loop through each button and add the action
Code:
statename.onRelease = function() { getURL(("http://www.mydomain.com" + this._name), "_self"); }
? The this._name doesn't really work with buttons so I think using an array might be easier but how can I access each button (without instance names) so that I grab the first element of the array and its actions are applied to the first button (instance1, they are in alphabetical order). Also, editting each states rollover and down shape is a pain, is it possible to make each one of those a symbol or something so that I can open it dynamically from the root level and change its color? The only problem I see is the function to change the color and the calling of the actual shape inside a button. Thank you so much for any help in advance.
View Replies !
View Related
Help With Dynamic Buttons
Hi,
I've made a christmas tree, and i created dynamic buttons(christmas balls) for every record in a database. The buttons are called ["but1"+i] where i is a variable for every record that is found in the database.
No, I want to place the buttons(christmas balls) into the christmas tree and not randomly on the stage. Does eneyone know how to do that??
Please help me...
Diluca
View Replies !
View Related
Dynamic Buttons In AS 3.0
Hey everyone,
I would like to make some dynamic buttons, with different texts:
I made this with help from Kirupa.com tutorials, but I don't seem to get it to work.
Code:
function Main() {
for (var i:int = 0; i < 10; i++) {
var bName = "button" +i;
var newButt:blueButton = new blueButton();
var randomValue:Number = Math.random()*1;
newButt.x = -100+Math.random()*500;
newButt.y = -100+Math.random()*400;
newButt.scaleX = newButt.scaleY = randomValue;
newButt.pooText.appendText = bName;
this.addChild(newButt);
}
}
Main();
My button class is called "blueButton" and my dynamic text instance is called "pooText".
I feel it should not be difficult, but i just dont seem to get it to work
View Replies !
View Related
Dynamic Buttons
Ok through the help of this forum I have managed to get a complete set of images pulled from a database and displayed on the screen... I have even been able to turn those images into buttons using by wrapping them into a sprite...
Ok on the buttons part of things I was wondering how can I make it to where each button does something different... Like I pull a value called userid from my database how could I make that value that is linked with that button be traced?
View Replies !
View Related
Dynamic Buttons
My interest is in creating a row buttons that are dynamically generated and placed as determined by xml content (number of buttons that is). The buttons are multiple instances of the same clip (attached) that contain textfields which display numbers (ie. 01, 02, ...20). The number of buttons generated shall be capped to a max of 20.
I have parts of it figured out and need help with others. The generation of the clips are handled by the following loop...
Code:
// Starting x & y values
var xPos:Number = 150;
var yPos:Number = 400;
// Maximum number of buttons allowed
var btnMax:Number = 20;
for (i = 0; i < gallery.length; i++) {
attachMovie("btn_mc", "btn"+i, this.getNextHighestDepth(), {_x:xPos, _y:yPos});
xPos += this["btn"+i]._width+5;
// Add the information
this["btn"+i].num.text = ?
The numbers on the buttons start with 01 and go up to 20. I am familiar with the method of concatinating "0" + i for the first 9 digits in the loop but then how do you account for the shift from "0" to "1" as the first digit in these two digit numbers? Know what I mean?
I do understand that in instances like this you can create an array where each of the number values are declared but that's not what I'm after here. I'd like to know what concatination methods are used in instances like this where the first number changes as well as the second number in double-digit numbers. I hope this makes sense.
Lastly, how would you approach creating rollover states for the text in the textfields of these dynamically generated buttons that have the numbers change color on rollover?
Three questions in a nutshell:
1) how do you cap the btnMax to 20 buttons?
2) how do you pass the correct numbers to the dynamic textfields without referencing an array directly for each of the values?
3) how do you create rollover states for the numbers?
Why "for smart people"? Because you are a smart person to have these answers. TIA.
View Replies !
View Related
Dynamic Buttons?
Hi
Im working on this photo album in which the user will be able to drag and drop pictures and place them on the pages of the album, sort of like Apple's iPhoto. The photos themselves need to be buttons (or placed on buttons) for this to work obviously.
The problem is, the pictures are never the same, they are chosen by the user in another web app and they can choose as many as they like. For this reason I need to be able to create buttons dynamically since I won't know how many buttons I'll need before runtime.
So Im using atachMovie to create movie clips dynamically and then loadMovie to load the pictures on to them. This works ok so far but then i tried adding the typical insvisible button inside the placeholder movie i use for attachMovie
but it doesn't seem to work as a button.
This is the simple code inside the button:
Code:
on (press) {
trace("It works!");
}
Is this even remotely possible? Maybe I need to aproach the problem differently? tHX
View Replies !
View Related
Dynamic Buttons
Hi, I'm making an image viewer which loads in the images and their info from XML. I'm wanting to have a list of the images titles, and clicking on a title brings up that image. I've parsed the XML into an array, and I'm using a FOR loop to go through the array and create a project_btn sprite, which contains a project_txt textfield within it to display it's name. As part of the FOR loop, I'm adding an event listener to listen for a ROLL_OVER event, which, for the moment just traces the project_btn's name. The problem I'm having is that it seems to only add the eventListener to the LAST project_btn... so the others are useless.
Code below:
private function drawNavList() {
navList = new Sprite();
navList.x = -(showWidth/2)-195;
navList.y = -50;
addChild(navList);
var projectID:Number;
for (projectID = 0; projectID<numberOfProjects; projectID++) {
var project_btn:Sprite = new Sprite();
var project_txt:TextField = new TextField();
format.size = 14;
format.color = signflairGrey;
format.font = font.fontName;
format.align = 'center';
project_txt.text = sectionData[projectID][0];
project_txt.setTextFormat(format);
project_txt.background = true;
project_txt.backgroundColor = 0xff0000;
project_txt.selectable = false;
project_txt.embedFonts= true;
project_txt.y = 20*projectID;
project_txt.width = 165;
project_txt.height = 14;
project_btn.name = String(projectID);
project_btn.addChild(project_txt);
project_btn.addEventListener(MouseEvent.ROLL_OVER, projectOVER);
navList.addChild(project_btn);
}//for>
}//drawNavList>
private function projectOVER(e:Event) {
trace((e.target).name);
}//projectOVER>
Would appreciate any thoughts or suggestions.
View Replies !
View Related
Dynamic Buttons
I am developing a sliding menu that will contain buttons. The text within the buttons is placed there using action script. I am trying to save having to create each button manually.
The dynamic buttons are in the slider MC.
The question is, why does the hitstate for the buttons that take up more than one line extend beyond the slider menu and how can I fix this? Also any other suggestions on how I could improve this will be welcomed.
Thanks for your help.
_t
View Replies !
View Related
Dynamic Buttons....
I need help in creating a dynamic button. Basically I want to have a movieclip in the library with a button and dynamic text box in it.
Therefore, I will call the attached movieClip and populate the buttons based on the values of my array. I believe I need to have a onmouse event for each movieclip/button right? How do I do this?
TabArray = ["menu1", "menu2", "menu3"];
_root .onLoad = function ()
{
var iMenuLength = TabArray.length;
for (j=0; j < iMenuLength; j++)
{
MenuName=TabArray[j];
attachMovie("Tab_Mc", myName , (j*10));
this[MenuName]._x = j * this[MenuName]._width;
this[MenuName]._y = 150;
this[MenuName]._alpha = 75;
}
};
View Replies !
View Related
Dynamic Buttons... Please Help
Hi all,
I am dynamically generating little buttons, but I can't figure out how to assign different "onRelease" values to each one...
here's the code I have...
Code:
for (var i=1; i<images.length; i++){
dynamicButton = attachMovie("button", "button"+i,i);
dynamicButton.buttonText = count;
dynamicButton.onRelease = function(){
trace(dynamicButton);
}
}
So, if it creates 3 buttons, each with it's own text (1, 2 and 3), ALL of the buttons will trace "_level0.button3"... sigh.
View Replies !
View Related
Help With Dynamic Buttons
Hey, people!
I've got the following problem: I'm trying to generate a menu using attachmovie, and this menu will load several images. the idea is fine, lol.
But what is really happening is that, as I click on any button, it just use the last array value, instead of assigning one value to each button separately.
The code below can illustrate this, but only with a trace. Where is my mistake?
Thanks a lot for the help.
Here goes the code:
Code:
// create the pics array:
var fotos:Array = new Array();
fotos = ["01.jpg","02.jpg","03.jpg","04.jpg","05.jpg","06.jpg","07.jpg","cobra_gde.jpg"];
_root.transicoes.foto_antiga.loadMovie(fotos[0]);
//create pictures menu:
for (i=0;i<fotos.length;i++){
botao_mc = attachMovie("button_mc","button"+i,_root.getNextHighestDepth());
foto_atual = fotos[i];
//buttons identifiers:
if(i<9) {
indice = i+1;
botao_mc.legenda = "0"+indice;
}else{
indice = i+1;
botao_mc.legenda = indice;
}
//buttons position:
botao_mc._x = 10;
if(i == 0){
botao_mc._y = 10;
}else{
botao_mc._y = 10 + (botao_mc._height*i) + 2;
}
//button animation:
botao_mc.onEnterFrame = function(){
if(this.hitTest(_xmouse,_ymouse,true)){
this.nextFrame();
}else{
this.prevFrame();
}
}
//button actions
botao_mc.botao.onRelease = function(){
trace(foto_atual);
}
}
View Replies !
View Related
Dynamic Buttons
Hi I'm creating a Conent Management system for a client's flash website and I wanted to know if anyone knew how to, through XML, PHP, MySQL
Duplicate movie clips containing a)dynamic text b) a button with a dynamic getURL link. The dynamic text and the URL links will derive from XML which will be created by PHP which will be pulled from MYSQL which will be updated by my client via a PHP admin section.
View Replies !
View Related
Dynamic Buttons
Hi all,
I'm trying to make dynamic buttons but can't get the buttons to function like a button.
Here is the code:
Code:
var xPos = 105;
var xChange = 5;
var imgName = "img";
var myThumbs:Array = Array(4);
myThumbs[0] = "images/thumbs/TNvnspots.jpeg";
myThumbs[1] = "images/thumbs/TNvnspots.jpeg";
myThumbs[2] = "images/thumbs/TNvnspots.jpeg";
myThumbs[3] = "images/thumbs/TNdes.jpg";
myThumbs[4] = "images/thumbs/TNsimpsons.jpg";
for(var i = 0; i < myThumbs.length; i++){
var mcc = createEmptyMovieClip(imgName, this.getNextHighestDepth());
imgName.onPress = function(){ //test on press for each image
trace("afda");
};
mcc._x = 30 + xChange;
mcc._y = 350;
imgName = "img" + i;
mcc.loadMovie(myThumbs[i]);
xChange +=102;
};
Thanks
nevermind, its solved
Code:
var xChange = 5;
var imgbtn = "img";
var myThumbs:Array = Array(4);
myThumbs[0] = "images/thumbs/TNvnspots.jpeg";
myThumbs[1] = "images/thumbs/TNvnspots.jpeg";
myThumbs[2] = "images/thumbs/TNvnspots.jpeg";
myThumbs[3] = "images/thumbs/TNdes.jpg";
myThumbs[4] = "images/thumbs/TNsimpsons.jpg";
for(var i = 0; i < myThumbs.length; i++){
imgbtn = this.createEmptyMovieClip(imgbtn, this.getNextHighestDepth());
imgbtn.onRelease = function() {
trace(this.imageLoad._url);
}
imgbtn._x = 30 + xChange;
imgbtn._y = 350;
imageLoad = imgbtn.createEmptyMovieClip("imageLoad", imgbtn.getNextHighestDepth());
imageLoad.loadMovie(myThumbs[i]);
imgbtn = "img" + i;
xChange +=102;
};
View Replies !
View Related
Dynamic Buttons
I am developing a sliding menu that will contain buttons. The text within the buttons is placed there using action script. I am trying to save having to create each button manually.
The dynamic buttons are in the slider MC.
The question is, why does the hitstate for the buttons that take up more than one line extend beyond the slider menu and how can I fix this? Also any other suggestions on how I could improve this will be welcomed.
Thanks for your help.
_t
View Replies !
View Related
Dynamic Buttons?
Hi there---just a quick question if you please...
I have a list of about 20 buttons that are too big to fit on the main movie, so naturally I want to have them scroll so the viewer can see them all. So:
Is it possible to place these buttons into a dynamic textbox so I can use them with the scroll component (as they are--as buttons)? And if not, what's the alternative (if any)?
The ultimate goal here is to have a movie play (on a different location of the stage) when the mouse rolls over the buttons. Every other aspect has been taken care of like the movie clips, buttons made, etc. I just need these darn things to scroll..
Any help would be appreciated! Thanks!
View Replies !
View Related
Dynamic Buttons
After reading a tutorial on kirupa and aditional options at this forum, i wanted to make an image gallery were the number of buttons that apear changes as there are more or less images in the image directory.
So if i have 2 images, there should be 2 buttons.
I've tried this, but... it doesn't work.
This is the code i used:
Code:
var sPlace:String = "images/";
lv = new LoadVars();
lv.onLoad = function(success) {
if (success) {
pArray = this.imgList.split(", ");
for (var i = 0; i<pArray.length-1; i++) {
_root.mcHolder.attachMovie("mcSquare", "mcSquare"+i, _root.getNextHighestDepth());
_root.mcHolder._x += i*100;
}
} else {
info.text = "could not load file";
}
};
lv.load("filearray.php");
The result i get is that 1 button is displayed, altough he does the loop several times.
Best regards,
Raf
(first time poster, long time reader )
View Replies !
View Related
Dynamic Buttons
I have a movie(web page). When clicking on a particular button, a call is made to asp script that connects to a database. The page that gets built depends on what's in the database. I need the built page to contain buttons that connect to the detail of that button. I have thought of having a particular button.swf in a field within the database and somehow incorporate this button into the new page. How do I do this and is this the way to do this.
Thanks
urb900
View Replies !
View Related
Dynamic Txt And Buttons..
Hiii all..
I have done a simple flash intro ( http://www.tnt-factory.dk/btbCRM.htm )with a couble of dynamic txt fields who is updated by a .txt document. But i also have some buttons where the url's is changing. Is there a way to change the url's in a other way instead of changing them in the .fla file. Like when you change the txt in the .txt document..
Thanks/Thomas.. :D
View Replies !
View Related
|