11 Replies Latest reply on Nov 11, 2009 9:03 AM by Gabriel R Couto

    Changing window title

    pavel.rydl

      Hello,

      I am trying to change title of main window, but without luck.

       

      I tried use external call and javascript, but it always shows, that Adobe Flash Player stopped, because of security. Same with getURL.

      I am trying to implement website into my .NET application, so It's unacceptable to have these errors.

       

      I would like to know, how to change title via ActionScript 2.0 or 3.0.

       

      Thank you.

        • 1. Re: Changing window title
          robdillon Most Valuable Participant

          Are you describing the browser window title? If that's the case, then this is changed using the <title>  </title> tag in the head section of the html document that contains the Flash file.

          • 2. Re: Changing window title
            pavel.rydl Level 1

            Hi, I am not talking about HTML by the way

             

            my question was "I would like to know, how to change title via ActionScript 2.0 or 3.0."

            • 3. Re: Changing window title
              robdillon Most Valuable Participant

              What window are you talking about then? The stage window in Flash when you are authoring? If this is the case, then that title shows the name of the file that is being authored. Change the file name and the title will change. If it is something else, then please provide a better explanation or a visual to illustrate the point.

              • 4. Re: Changing window title
                pavel.rydl Level 1

                Ok, sorry, I am not native english speaker, so i have to fight a little with english.

                 

                After I click on publish in Adobe Flash App, it generates flash file and HTML file. I click on HTML file, webbrowser opens a window. THIS window has title. Yes i can change ittle with HTML by changing <title></title> but i want to change this title realtime, so i need a function, which can change that title.

                 

                Don't ask me why i want to change it. As i said, I tried to execute Javascript with getURL or External.Call (or how does this function is called), but it always shows "Adobe Flash Player has stopped a potentially unsafe operation".  Because of this error, i would like to know, how to change it via ActionScript.

                • 5. Re: Changing window title
                  robdillon Most Valuable Participant

                  The only way that I can find to set the title of an html window is if that window is created in Javascript using window.open(). The second argument is the name of the window. This will show up at the top of the html window. You can change the name of the window using Javascript: window.name. But this change will not be reflected in the actual html window unless you reload the page.

                   

                  You can use ExternalInterface.call() to call a Javascript function from the Flash movie.

                  • 6. Re: Changing window title
                    pavel.rydl Level 1

                    Why i need to resend my messages again and again, have you read my all messages ?

                     

                    "You can use ExternalInterface.call() to call a Javascript function from the Flash movie."

                     

                    from my older message:

                    ExternalInterface.call() always shows "Adobe Flash Player has stopped a potentially unsafe operation". 

                     

                    if you don't know, just say "I dont know"

                    • 7. Re: Changing window title
                      robdillon Most Valuable Participant

                      You're absolutely right. I have no idea what it is that you want. Do you want me to look up a browser message alert for you? Do you want to know how to write a particular function in actionscript? I understand that you're not a native speaker of English and I'm very patient with your efforts to make your needs known, but its not working very well, at least for me.

                       

                      I don't have any idea what your base question is. I thought that you wanted to change the name of a browser document. I explained in my last message that you can only do that if you refresh the page. In your third message you said:

                       

                      As i said, I tried to execute Javascript with getURL or External.Call (or how does this function is called), but it always shows "Adobe Flash Player has stopped a potentially unsafe operation".

                       

                      In an effort to clarify, I replied that you needed to use ExternalInterface.call() to a Javascript function. The clarification was both to your incorrect reference above and to the fact that you needed to use Javascript to communicate from Flash to the DOM. The unsafe operation that is referenced in your quote is, most likely, to the Flash player settings that you have set, or, that you are using Internet Explorer. Neither of which I can fix from here.

                      • 8. Re: Changing window title
                        pavel.rydl Level 1

                        I don't understant, why you don't understand :-)

                         

                        Ok, Again.

                        Do you know, what is window title ? yes, you know i hope. For example now, there is Adobe Forums: Post Reply .... etc. It's top of browser window.

                        I want to change it realtime via FLASH. I think, It's clear.

                         

                        Yes, i tried ExternalInterface.call('window.document.title = "something"'); this function, but it shows stupid Adobe error about security.

                        I tried to add javascript function to the HTML file, and tried to call it ExternalInterface.call('changeDocumentTitle','New Title!');  ... same stupid security error. Can i turn this stupid error off ?? but it should be OFF everywhere on every PC.

                        • 9. Re: Changing window title
                          robdillon Most Valuable Participant

                          Good luck in your search for the answer.

                          • 10. Re: Changing window title
                            pavel.rydl Level 1

                            eh, sorry, but I am on official forum and you are "expert". I thought, you are experienced with flash.

                             

                            It's a pity, you can't give me right advice about this simple thing like change title of window ;-) It's shame.

                             

                            But thank you, that you tried to help me.

                            • 11. Re: Changing window title
                              Gabriel R Couto

                              Hello pavel.rydl,

                               

                              If you want to change the page title at runtime, you can use this code:

                               

                              ExternalInterface.call("function() {document.title = 'New Page title';}");

                               

                              It's works for me with many web browsers, and in the new Flex 4 ;-)

                               

                              Good luck!

                               

                              []'s

                              Gabriel