Well what I thought is maybe not right, but what I want is when you click the next button another text will appear ( that works) and when you click next again some other text must show up.
Printable View
Well what I thought is maybe not right, but what I want is when you click the next button another text will appear ( that works) and when you click next again some other text must show up.
Here is a piece of my imagination trying to imagine your setup... :D i imagine that your code is in a class in ".as" file... if not, it might need some minor modifications... Here goes:
This version of your code should go forward and backward through the array of textboxes, specified at the beginning of this snippet... Looping is not implemented here, but it's not hard to change to implement looping (like in photo slide show)... Basically each time you click prev/next buttons, you assign correct values to buttons themselves + hide previously visible textBox + show new textBox...PHP Code:import flash.display.TextField;
private var textBoxes:Array = [TextOverMij, TextOverMij2, TextOverMij3]; // Fill this array with text boxes that should be shown in sequence.
private var currentTextBoxIndex:int = 0;
private var currentTextBox:TextField = null;
function overMijClick(e:MouseEvent)
{
addChild(marci);
marci.x = 520;
marci.y = 200;
marci.alpha = 0;
TweenLite.to(marci, 1, {autoAlpha:1});
trace(overmij);
homePage.visible = false;
showRoomPage1.visible = false;
showRoomPage2.visible = false;
showRoomPage3.visible = false;
contactPage.visible = false;
currentTextBoxIndex = 0;
currentTextBox = textBoxes[currentTextBoxIndex];
screen.addChild(currentTextBox);
currentTextBox.x = 0;
currentTextBox.y = 0;
TweenLite.to(currentTextBox, 0.5, {x:265, y:225, motionBlur:true, ease:Circ.easeOut});
screen.addChild(nextText);
nextText.x = 400;
nextText.y = 400;
nextText.visible = true;
prevText.gotoAndPlay(1);
screen.addChild(prevText);
prevText.x = 300;
prevText.y = 400;
prevText.visible = false;
nextText.addEventListener(MouseEvent.CLICK, nextClick);
prevText.addEventListener(MouseEvent.CLICK, prevClick);
}
function nextClick(e:MouseEvent)
{
trace(":Hoi");
currentTextBoxIndex++;
if (currentTextBoxIndex >= textBoxes.length - 1)
{
nextText.visible = false;
}
if (currentTextBoxIndex > 0)
{
prevText.visible = true;
}
if (currentTextBox != null)
{
currentTextBox.visible = false;
}
currentTextBox = textBoxes[currentTextBoxIndex];
currentTextBox.visible = true;
screen.addChild(currentTextBox);
currentTextBox.x = 225;
currentTextBox.y = 225;
}
function prevClick(e:MouseEvent)
{
prevText.gotoAndPlay("prevAlpha2");
currentTextBoxIndex--;
if (currentTextBoxIndex <= 0)
{
prevText.visible = false;
}
if (currentTextBoxIndex < textBoxes.length - 1)
{
nextText.visible = true;
}
if (currentTextBox != null)
{
currentTextBox.visible = false;
}
currentTextBox = textBoxes[currentTextBoxIndex];
currentTextBox.visible = true;
}
Hope it helps... :D
Im getting the following error :
TypeError: Error #1034: Afgedwongen typeomzetting is mislukt: kan overmijText@db474c1 niet omzetten in flash.text.TextField.
at Main/overMijClick()
What type is that overmijText? I assumed it's TextField...
then change this line:
into this:PHP Code:private var currentTextBox:TextField = null;
it's at the very beginning of my snippet, posted earlier...PHP Code:private var currentTextBox:MovieClip = null;
Thanks for the effort, but theres still a problem.
Sometimes the 3rd part of the text doesnt show up on the next click, sometimes it does, and then when i click on the prev. button it goes back tot the 2nd part over text, but then the prev. button dissapears because that is written in the function...
I honestly don't know what to say.... Next button is supposed to disappear only when showing the last box and prevButton should disappear only when the first box is displayed... if a second text box is visible, then currentTextBoxIndex should be "1" and thus it's not <= 0 and prev button should not disappear... :S
Hmmm.. Thanks for everything... maybe i should try it the old way :(