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

Re: 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


Re: changing substring to a variable number
by Shane Williams on Nov 6, 2009 at 8:25:37 am

Thanks for the advice, will have to check it out the XML tutorial. I wanted to sort this out as I learnt about substrings and I added a tween as well!
I got a good response from Rich Schupe at Learning Action Script 3.0 and used this to change the substring to the new Var. It needed to be an integer.

var frameVar:int = 1;

function thumbnailClick(evt:MouseEvent):void
{
var imageName:String = (evt.target.name);
frameVar = int(imageName.substring(5, imageName.length));
loadImageLarge();
trace("this is myString "+imageName);
}

function loadImageLarge():void
{
//////////trace button
/////////////goes to the scene of the button clicked
mediaData_mc.photosFadeUp_mc.photosData_mc.photoLargeLoad_mc.gotoAndStop("image"+frameVar);
mediaData_mc.photosFadeUp_mc.photosData_mc.photoLargeLoad_mc.PhotoContainerLarge_mc.gotoAndStop("image"+frameVar);
fadeTween = new Tween(mediaData_mc.photosFadeUp_mc.photosData_mc.photoLargeLoad_mc.PhotoContainerLarge_mc,"alpha", None.easeNone,0,1,1,true);
trace("this is the frameVar "+frameVar);
}

////////////////goes to the next frame
function loadImageLargeNext(event:MouseEvent):void
{
//////////trace button
trace("frameVar "+frameVar+" number");
/////////////goes to image plus the new number
frameVar++;
mediaData_mc.photosFadeUp_mc.photosData_mc.photoLargeLoad_mc.gotoAndStop("image"+frameVar);
mediaData_mc.photosFadeUp_mc.photosData_mc.photoLargeLoad_mc.PhotoContainerLarge_mc.gotoAndStop("image"+frameVar);
fadeTween = new Tween(mediaData_mc.photosFadeUp_mc.photosData_mc.photoLargeLoad_mc.PhotoContainerLarge_mc,"alpha", None.easeNone,0,1,1,true);

}

////////////////goes to the next frame
function loadImageLargePrevious(event:MouseEvent):void
{
//////////trace button
trace("go to this "+event.target.name+" "+frameVar+" in the Gallery section");
/////////////goes to image minus the new number
frameVar--;
mediaData_mc.photosFadeUp_mc.photosData_mc.photoLargeLoad_mc.gotoAndStop("image"+frameVar);
mediaData_mc.photosFadeUp_mc.photosData_mc.photoLargeLoad_mc.PhotoContainerLarge_mc.gotoAndStop("image"+frameVar);
fadeTween = new Tween(mediaData_mc.photosFadeUp_mc.photosData_mc.photoLargeLoad_mc.PhotoContainerLarge_mc,"alpha", None.easeNone,0,1,1,true);

}



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]