htmlurlflashhyperlinkcue-points

Flash cue points: Link from a website to specific point in a flash animation


Well the title basically said it all. I want to be able to link to a cue point in a flash animation

I've searched and searched in Google but all I can see was linking from flash to a website based on a que point.
The idea is this: I create an animation in flash that contains multiple languages.
I want to create multiple links on my website. The user clickes a link in their language and opens the movie at the right "cue" point where his/her language shows.

I think this can be done with cue points but I'm not really the flash-expert to know how this works. Hope that somebody else can provide me with some solid information!

M.


Solution

  • You can try using variables in the link addresses. This means just add something like ?lang=eng at the end of your linked URL. Flash can read that address (only from HTML embed) and have code that does something depending on what comes after the lang= part.

    There's better ways to do this including real variable parsing but I just went with a simple converting browser address to String and then extract the last (language) bit. Just to see if that works too.

    For testing only you need an MC and two textfields on stage with these instance names:

    customising: you can customise your variable with these two lines:

    var Index_one:int = 5 + int( tempSTR.indexOf("lang=") );
    Here 5 is because lang= has five characters. When you change the word you must change the number to match word/symbols length also.
    case "eng" must match the language code you choose (eg: if you go with ?lang=english_UK then in code it becomes case "english_UK"

    import flash.display.MovieClip;
    import flash.external.ExternalInterface;
    
    
    var str_url :String = "";
    
    get_Language();
    
    
    function get_Language () : void
    {
        // GET LANGUAGE
        var url:String = ExternalInterface.call("window.location.href.toString");
        if (url != null) //if is not null 
        { txt_url.text = url; txt_lang.text = get_lang_URL(url); }
    
        //SET BY LANGUAGE
        if (txt_lang.length > 0) //if is not null 
        { 
            switch(txt_lang.text)
            {
    
                case "eng": MC_lang.gotoAndStop(1); break;
                case "jap": MC_lang.gotoAndStop(2); break;
                case "bra": MC_lang.gotoAndStop(3); break;
            }
    
        }
    
    }
    
    //EXTRACT LANGUAGE VARIABLE FROM ADDRESS
    function get_lang_URL (input_str:String):String
    {
        var tempSTR:String = input_str;
        var finalSTR:String = "";
    
        var Index_one:int = 5 + int( tempSTR.indexOf("lang=") );
        var Index_two = input_str.length - Index_one;
    
        finalSTR = tempSTR.substr(Index_one, Index_two );
        return finalSTR;
    }