Creative COW SIGN IN :: SPONSORS :: ABOUT US :: CONTACT US
ADOBE FLASH: HomeFlash ForumFlash TutorialsFlash Video TutorialsWeb Streaming ForumAdobe FlashPodcast

changing substring to a variable number

Cow Forums : Adobe Flash
VIEW POSTS   •   ADD A NEW POST   •   SEARCH   •   CHANGE FORUM
Respond to this post   •   Return to posts index   •   Read entire thread


changing substring to a variable number
by Shane Williams on Nov 3, 2009 at 2:26:00 am

I have thumbnail images called "image1" to "image12" and when you click on these images they take you to the frame label with the larger image in another movie clip. I am hard coding mostly.

It works fine when you click image 1 because it adds 1 everytime but I don't know how to use the substring to convert the frameVar to the thumbnail that has been chosen.


I want to use the number on image4 and change that to my number variable. I am using myString.substring(5,7)); to take out the numbers from image5 when it is clicked but can't convert that to a number to update the frameVar.

I start off with


var frameVar:Number = 1;


mediaData_mc.photosFadeUp_mc.photosData_mc.image1.addEventListener(MouseEvent.CLICK, loadImageLarge);


//////////////////photo gallery section load

function loadImageLarge(event:MouseEvent):void

{

//////////trace button

/////////////goes to the scene of the button clicked

var myString:String = (event.target.name);

mediaData_mc.photosFadeUp_mc.photosData_mc.photoLargeLoad_mc.gotoAndStop(myString);

trace(myString.substring(5,7));

}


////////////////the trace works and I get the number but I don't know how to convert this from text to a number and change my frameVar to the thumbnail selected


////////////////goes to the next frame once in the photoLargeLoad_mc

function loadImageLargeNext(event:MouseEvent):void

{

//////////trace button

trace("go to this "+event.target.name+" "+frameVar+" in the Gallery section");

/////////////goes to image plus the new number

frameVar++;

mediaData_mc.photosFadeUp_mc.photosData_mc.photoLargeLoad_mc.gotoAndStop("image"+frameVar);

}


Thanks for the help! I am obviously new to AS 3.


Respond to this post   •   Return to posts index   •   Read entire thread


Current Message Thread:




Note: If you are a registered user please click here to login before posting.

Your post will not be accepted if your name and email address are not registered in our database. Click here if you do not have an account.

Name
E-Mail Address
Subject
E-Mail me when someone responds
Just This Message   Entire Thread   None  

Message:



Note: The following are HTML characters and may cause parts of your post to disappear if not used correctly: < > &
To include any portion of the post in your response, highlight the desired text and hit the "Q" key. Read more...



Add your message signature


 


Note: By clicking "Post Direct" button above, you are agreeing to the Creative Cow's Code of Conduct.



FORUMSTUTORIALSMAGAZINETRAININGVIDEOS - REELSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

© CreativeCOW.net All rights are reserved.

[Top]