-
Senior Member
Getting name of movie loaded on a level
Hi
It may be pretty basic but I'm looking for the easy way out. I've a container that loads a movie on level10 using loadMovieNum(). Is there a way I can get the name of this movie?.
I'm using Flash CS5 and AS 2.0
-
Senior Member
-
Prid - Outing
Post your code!
And besides, don't you have to know the name for use loadMovieNum? :S
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
-
Senior Member
Hi .. thanks for your reply .. yes that I do know ..
I'm tried a different approach and it worked .. following is what I did
Actionscript Code:
var myMovieName:String = 'Trash/intro.swf'; var onlyMovieName:String; loadMovieNum(myMovieName,10);
function parseStr(theStr:String) { var myArrStr:Array = theStr.split(""); var code:Number; var endNum:Number; for (i=0; i<myArrStr.length; i++) { if (myArrStr[i] == '/') { code = i; } else if (myArrStr[i] == myArrStr) { endNum = i; } } onlyMovieName = theStr.substring(code, endNum); }
parseStr(myMovieName);
trace (onlyMovieName); var myMovieName:String = 'EnglishTrash' + onlyMovieName; trace (myMovieName);
And this idea came to my head after reading :
http://www.kirupa.com/forum/showthre...ng-up-a-string
-
Prid - Outing
Oh you only wanted the name of the movie without Trash/ and swf?
Well, looks like you solved it, but here's another approach:
Actionscript Code:
var myMovieName:String = 'Trash/intro.swf'; var onlyMovieName:String; loadMovieNum(myMovieName,10);
onlyMovieName = ((myMovieName.split("/"))[1].split("."))[0]; trace(onlyMovieName);
Looks complex, but it's all of the steps below in just one step:
Actionscript Code:
var myMovieName:String = 'Trash/intro.swf'; var onlyMovieName:String; loadMovieNum(myMovieName,10);
removeTrash = myMovieName.split("/"); // will give Trash and intro.swf as indexes 0 and 1 removeSWF = removeTrash[1].split("."); // will give intro and swf as indexes 0 and 1 onlyMovieName = removeSWF[0]; trace(onlyMovieName); // will trace intro
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
-
Senior Member
Many thanks Nig .. I'll definitely try your solution ... This is as far I could go with Google Coding
Cheers !!
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
|