-
dynamic text changing with button click
Ok, I have a variable that I define like so:
whichPic = 1;
Then I have two buttons that scroll through the pics and increments them like so:
whichPic++;
whichPic--;
Then at the bottom of my code I have if statements that try to load text into my dynamic text box name "txtName" like so:
if (whichPic==1){
txtName.text = "Name1";
}
else if (whichPic==2){
txtName.text = "Name2";
}
The pics scroll fine but the text does not change when you hit the next or back button?????
-
Re: dynamic text changing with button click
Originally posted by jagreen78
Ok, I have a variable that I define like so:
whichPic = 1;
Then I have two buttons that scroll through the pics and increments them like so:
whichPic++;
whichPic--;
Then at the bottom of my code I have if statements that try to load text into my dynamic text box name "txtName" like so:
if (whichPic==1){
txtName.text = "Name1";
}
else if (whichPic==2){
txtName.text = "Name2";
}
The pics scroll fine but the text does not change when you hit the next or back button?????
I didn't use any picks but I tested the code with a dynamic text field and two buttons with your code. Must be an issue with the naming of the text field or where you intialized whichPic.
My test worked with everything on the first frame (only frame) of the movie. Make sure that txtName is what you put in the instance name field of your textfield, not in the Var field.
Post an fla for more help.
---
Thinking outside of the box will get you fired if the "box" is strict budget.
-
ok
whichPic = 1;
// initiate change to new image when buttons are clicked
next.onPress = function() {
if (whichPic<24 && !fadeIn && !fadeOut) {
whichPic++;
}
};
back.onPress = function() {
if (whichPic>1 && !fadeIn && !fadeOut) {
whichPic--;
}
};
_root.onEnterFrame = function() {
if (square._alpha<10) {
loadMovie("../fimages/image"+whichPic+".swf", "_root.square");
}
if (whichPic==1) {
txtName.text = "BrookStone Meadows";
} if (whichPic==2) {
txtName.text = "Verdae Greens Golf Club";
} if (whichPic==3) {
txtName.text = "Boscobel Country Club";
} if (whichPic==4) {
txtName.text = "Falcon's Lair";
} if (whichPic == 5) {
txtName.text = "Cobb's Glen";
} if (whichPic == 6) {
txtName.text = "Carolina Springs Golf Club";
} if (whichPic == 7) {
txtName.text = "Woodfin Ridge";
} if (whichPic == 8) {
txtName.text = "Village Green Golf Club";
} if (whichPic == 9) {
txtName.text = "Verdae Greens Golf Club";
} if (whichPic == 10) {
txtName.text = "Village Green Golf Club";
} if (whichPic == 11) {
txtName.text = "Millstone Golf Village";
} if (whichPic == 12) {
txtName.text = "River Falls Plantation";
} if (whichPic == 13) {
txtName.text = "Southern Oaks";
} if (whichPic == 14) {
txtName.text = "Brookstone Meadows";
} if (whichPic == 15) {
txtName.text = "Boscobel Country Club";
} if (whichPic == 16) {
txtName.text = "Cobb's Glen";
} if (whichPic == 17) {
txtName.text = "Carolina Springs Golf Club";
} if (whichPic == 18) {
txtName.text = "Falcon's Lair";
} if (whichPic == 19) {
txtName.text = "Furman";
} if (whichPic == 20) {
txtName.text = "River Falls Plantation";
} if (whichPic == 21) {
txtName.text = "Furman";
} if (whichPic == 22) {
txtName.text = "Millstone Golf Village";
} if (whichPic == 23) {
txtName.text = "Southern Oaks";
} else {
txtName.text = "Woodfin Ridge";
}
};
-
??????
Did you submit accidentally before you finished?
---
Thinking outside of the box will get you fired if the "box" is strict budget.
-
that is my code
that is exactly what is in the frame of my movie
whichPic is a number (1 thru 24) on the end of the imageN.swf where "N" is the number.
but my if statements don't pic up the number and match the appropiate text with it.
-
Member of the Flashist Party
It may just be a referencing problem (ie. _root.txtName.text or _parent.txtName.text).
Are you sure that on the properties of the dynamic text box you have nothing in the variable box?
Also, you may want to try the following:
Code:
picDescriptions = new Array ["BrookStone Meadows","Verdae Greens Golf Club", etc...];
txtName.text = picDescriptions[whichPic - 1];
This way, your descriptions are stored in an array and whichPic - 1 will reference the description. Since arrays start with 0 instead of 1, if whichPic=2, the corresponding description would be Verdae Greens Golf Club.
If you can't convince them,
confuse them...
-
Checkout this zip file and see if that is what you want to do: http://152.14.19.157/public/golf.zip File was too big to upload.
Then I can talk about how to fade in and out.
---
Thinking outside of the box will get you fired if the "box" is strict budget.
-
Can't download file
When I click on that link it wants me to sign on to something?
-
Re: Can't download file
Originally posted by jagreen78
When I click on that link it wants me to sign on to something?
Damn computers, try this > http://breezydesigns.com/golf.zip
---
Thinking outside of the box will get you fired if the "box" is strict budget.
-
hmm..it works ok for me.. just change your button codes to:
Code:
back.onPress = function() {
if (_root.whichPic>1) {
_root.whichPic--;
_root.changePic(_root.whichPic);
}
};
next.onPress = function() {
if (_root.whichPic!=_root.totalPics) {
_root.whichPic++;
_root.changePic(_root.whichPic);
}
};
this stops _root.whichPic going below 0 or above _root.totalPics.
Last edited by CoolBoardr; 11-06-2002 at 05:34 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|