A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Getting name of movie loaded on a level

  1. #1
    Senior Member sakie's Avatar
    Join Date
    Apr 2005
    Location
    London
    Posts
    285

    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

  2. #2
    Senior Member sakie's Avatar
    Join Date
    Apr 2005
    Location
    London
    Posts
    285

    Unhappy

    Any help guys???

  3. #3
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    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

  4. #4
    Senior Member sakie's Avatar
    Join Date
    Apr 2005
    Location
    London
    Posts
    285

    Thumbs up

    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

  5. #5
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    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

  6. #6
    Senior Member sakie's Avatar
    Join Date
    Apr 2005
    Location
    London
    Posts
    285

    Thumbs up

    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center