33 Replies Latest reply on Mar 19, 2012 3:11 AM by maxwel11

    AS2 problem

    maxwel11

      System.security.allowInsecureDomain( '*' );

      System.security.allowDomain( '*' );

      System.security.allowDomain( 'www.youtube.com' );

      System.security.allowInsecureDomain( 'www.youtube.com' );

      System.security.allowDomain( 'youtube.com' );

      System.security.allowInsecureDomain( 'youtube.com' );

      System.security.allowDomain( 's.ytimg.com' );

      System.security.allowInsecureDomain( 's.ytimg.com' );

      System.security.allowDomain( 'i.ytimg.com' );

      System.security.allowInsecureDomain( 'i.ytimg.com' );

      System.security.loadPolicyFile("http://i.ytimg.com/crossdomain.xml");

      System.security.loadPolicyFile("http://i1.ytimg.com/crossdomain.xml");

      System.security.loadPolicyFile("http://i2.ytimg.com/crossdomain.xml");

      System.security.loadPolicyFile("http://i3.ytimg.com/crossdomain.xml");

      System.security.loadPolicyFile("http://i4.ytimg.com/crossdomain.xml");

      System.security.loadPolicyFile("http://s.ytimg.com/crossdomain.xml");

      System.security.loadPolicyFile("http://www.youtube.com/crossdomain.xml");

       

       

      // create a MovieClip to load the player into

      var ytplayer:MovieClip = _root.createEmptyMovieClip("ytPlayer", 1);

       

      ytPlayer._x = 221

      ytPlayer._y = 300

      ytPlayer._xscale = 75

      ytPlayer._yscale = 75

       

      // create a listener object for the MovieClipLoader to use

      var ytPlayerLoaderListener:Object = {

        onLoadInit: function() {

          // When the player clip first loads, we start an interval to

          // check for when the player is ready

          loadInterval = setInterval(checkPlayerLoaded, 250);

        }

      };

       

      var loadInterval:Number;

       

       

      function checkPlayerLoaded():Void {

          // once the player is ready, we can subscribe to events, or in the case of

          // the chromeless player, we could load videos

          if (ytplayer.isPlayerLoaded()) {

              ytplayer.addEventListener("onStateChange", onPlayerStateChange);

              ytplayer.addEventListener("onError", onPlayerError);

              clearInterval(loadInterval);

          }

      }

       

      function onPlayerStateChange(newState:Number) {

          trace("New player state: "+ newState);

      }

       

      function onPlayerError(errorCode:Number) {

          trace("An error occurred: "+ errorCode);

      }

       

      // create a MovieClipLoader to handle the loading of the player

      var ytPlayerLoader:MovieClipLoader = new MovieClipLoader();

      ytPlayerLoader.addListener(ytPlayerLoaderListener);

       

      // load the player

      myLoadVars = new LoadVars();

      myLoadVars.onLoad = function() {

      zal = myLoadVars.myHTMLdata;

       

       

      ytPlayerLoader.loadClip(zal, ytplayer);

      };

      myLoadVars.load("youtubelink.txt");

      //scale it

       

      _root.ytplayer._x = 221

      _root.ytplayer._y = 300

      _root.ytplayer._xscale = 75

      _root.ytplayer._yscale = 75


       

      And my output which is my problem


       

      Code:

       

      *** Security Sandbox Violation *** SecurityDomain 'http://s.ytimg.com/crossdomain.xml' tried to access incompatible context 'http://www.youtube.com/crossdomain.xml'


      everything appear and the movie clip but i cant remove the movie clip anymore cuz that error is there which stops it from removing...


      so any idea???

       

      help is so much needed. so please try to help me.

       

      Thnanks in advance

        • 1. Re: AS2 problem
          maxwel11 Level 1

          why no one can help me with solving that problem?? cuz non can help in other forums too. is it impossible to fix that problem???

          • 2. Re: AS2 problem
            kglad Adobe Community Professional & MVP

            what's your url?

            • 4. Re: AS2 problem
              kglad Adobe Community Professional & MVP

              i see a failure to upload a flvplayback skin.  to remedy, upload your skin(s).

               

              i don't see that cross-domain error message.  what needs to be clicked to trigger it?

              • 5. Re: AS2 problem
                maxwel11 Level 1

                ik i am the one who removed the flv skin and i am not talking about that video. i am talking about the youtube video in the video section. press the disc with "video" title and u gonna find it. the problem that cuz there is a domain error message the movie clips can't be removed like b4 (it was working well before) when i press the video button then any other button after. which they got a  ytPlayer removeMovieClip(); function

                 

                thanks alot for ur help

                • 6. Re: AS2 problem
                  kglad Adobe Community Professional & MVP

                  i don't see that error message.  i see the problem but no cross-domain error message:

                   

                  i see this trace output:

                   

                  Never Control My Feelings  Wild Lion  Never Control My Feelings - Wild Lion.mp3

                  Fire Alarms  Wild Lion  Fire Alarms - Wild Lion.mp3

                  Da Freaky Dancer  Wild Lion  Da Freaky Dancer - DJ Wild Lion.mp3

                  Electronic Tango  Wild Lion  Electronic Tango - Wild Lion.mp3

                  Dance Until Fainting V.1  Wild Lion  Dance Untill Fainting - Wild Lion -V1-.mp3

                  David Tort/Changes  Wild Lion Remix  David Tort - Changes (DJ Wild Lion Remix).mp3

                  BobSinclar/LoveGeneration  WildLionRemix  Bob Sinclar - Love generation -DJ Wild Lion Remix-.mp3

                  Spirit Guitar  Wild Lion  Spirit Guitar - Wild Lion.mp3

                  Fear is not mine  Wild Lion  Fear is not mine - Wild Lion.mp3

                  Welcome to the party land  Wild Lion  Welcome to the party land - Wild Lion.mp3

                  • 7. Re: AS2 problem
                    maxwel11 Level 1

                    these are the songs that the flash player plays but this isn't the problem the problem is that the movieclip that the youtube vid inside it can't be removed like b4 it was working well b4 but not its not so what is the problem?? when i get on flash pro and compile the project the output "

                    *** Security Sandbox Violation *** SecurityDomain 'http://s.ytimg.com/crossdomain.xml' tried to access incompatible context 'http://www.youtube.com/crossdomain.xml'"

                     

                    appears which wasn't there when it used to get removed so probably and i am sure its the main problem since youtube changed thier ****in policy,duh

                     

                     

                    thanks so so so much

                    • 8. Re: AS2 problem
                      kglad Adobe Community Professional & MVP

                      i don't see a sandbox violation.  i suspect you see it locally but i'm sceptical that you're seeing it when testing online.

                       

                      so, what is the value of zal?

                      • 9. Re: AS2 problem
                        maxwel11 Level 1

                        locallly? how i cleaned my cache of my browser and still the video can't get removed :S. yea the output appears only locally but probably its error that don make movieclip get removed,. and what is zal?

                        • 10. Re: AS2 problem
                          kglad Adobe Community Professional & MVP

                          zal is from your code.  is that your code or did you get it elsewhere?

                           

                          and what are you doing to remove ytPlayer when another button is clicked?

                          • 11. Re: AS2 problem
                            maxwel11 Level 1

                            it is my code but i did it like 3 years ago and thats why i used as2 so probably zal is var and i don remember what it is equal to. thats why i was askin.

                             

                            and about temoving. yea i got action for all button except for video one to remove movie clip that contain youtube vid inside it. which is instance "ytPlayer".

                             

                            put in consideration that it was workin so fine but idk it changed alone onetime n i believe still due to youtube new policy and the output error dat i mentioned snove is the readon that movieclip cant be removed anymore

                             

                            thanks alot

                            • 12. Re: AS2 problem
                              maxwel11 Level 1

                              sorry i couldnt use the edit button cuz i am on my phone atm. but i forgot to tell u that i remove movie clip when another button is clicked by "ytPlayer.removeMovieClip()" function

                               

                               

                              thanks in advance

                              • 13. Re: AS2 problem
                                kglad Adobe Community Professional & MVP

                                where's ytPlayer.removeMovieClip()?  i don't see it in your code.

                                • 14. Re: AS2 problem
                                  maxwel11 Level 1

                                  it is action in keyframe on layer9. and that how it looks like "

                                  button_music.onRelease = function() {

                                  gotoAndStop(12);

                                  ytplayer.stop();

                                  ytplayer.removeMovieClip();

                                  ytplayer.NetStream.stop();

                                  ytplayer.destroy();

                                   

                                   

                                  }; "

                                   

                                  this one is for the music button for example.

                                   

                                  and about zal as i said its a var but cuz i did that code long time ago i didn't remember, and it part of youtube movieclip loader code that i posted at the first post and here it is the part:

                                  "

                                  myLoadVars = new LoadVars();

                                  myLoadVars.onLoad = function() {

                                  zal = myLoadVars.myHTMLdata;

                                   

                                   

                                   

                                   

                                  ytPlayerLoader.loadClip(zal, ytplayer);

                                  };

                                  myLoadVars.load("youtubelink.txt");

                                   

                                  "

                                   

                                  thanks alot

                                  • 15. Re: AS2 problem
                                    kglad Adobe Community Professional & MVP

                                    use:

                                     

                                     

                                    button_music.onRelease = function() {

                                    ytPlayer.removeMovieClip();

                                    gotoAndStop(12);

                                    };

                                     

                                    • 16. Re: AS2 problem
                                      maxwel11 Level 1

                                      same thing same problem nothing changed. the problem that it was workin well but one time changed

                                      • 17. Re: AS2 problem
                                        kglad Adobe Community Professional & MVP

                                        then you probably have a path problem.  use:

                                         

                                         

                                         

                                         

                                        button_music.onRelease = function() {

                                        _root.ytPlayer.removeMovieClip();

                                        gotoAndStop(12);

                                        };

                                         

                                        if that fails, show the trace output after clicking that button and using

                                         

                                         

                                         

                                        button_music.onRelease = function() {

                                        trace(_root.ytPlayer);

                                        _root.ytPlayer.removeMovieClip();

                                        trace(_root.ytPlayer);

                                        gotoAndStop(12);

                                        };

                                         

                                        • 18. Re: AS2 problem
                                          maxwel11 Level 1

                                          i tried to add _root as prefix before removeMovieClip before and didn't work. thought it was path problem. like u did but nah. i tried it again right now to be more sure but still don work. and it can't be path problem cuz it was working well before already. trust me it was.

                                           

                                          and yea i traced " _root.ytPlayer" and this was the output:

                                           

                                          *** Security Sandbox Violation *** SecurityDomain 'http://s.ytimg.com/crossdomain.xml' tried to access incompatible context 'http://www.youtube.com/crossdomain.xml'
                                          
                                          _level0.ytPlayer
                                          _level0.ytPlayer
                                          

                                           

                                           

                                          thanks alot for ur help. man


                                          • 19. Re: AS2 problem
                                            kglad Adobe Community Professional & MVP

                                            copy and paste the trace output from the following.

                                             

                                            button_music.onRelease = function() {

                                            trace(_root.ytPlayer.getDepth());

                                            trace(ytPlayerLoader);

                                            _root.ytPlayer.removeMovieClip();

                                            gotoAndStop(12);

                                            };

                                            • 20. Re: AS2 problem
                                              maxwel11 Level 1

                                              this is the trace output result:

                                               

                                              *** Security Sandbox Violation ***
                                              SecurityDomain 'http://s.ytimg.com/crossdomain.xml' tried to access incompatible context 'http://www.youtube.com/crossdomain.xml'
                                              -16375
                                              [object Object]
                                              

                                               

                                               

                                              Thanks so much for ur much of effort trying to help

                                              • 21. Re: AS2 problem
                                                kglad Adobe Community Professional & MVP

                                                you have more than one ytPlayer floating around. 

                                                 

                                                use movie explorer to search for one (or more) that you created on-stage.  when you find it, delete it and retest using the same trace() from message 19.

                                                • 22. Re: AS2 problem
                                                  maxwel11 Level 1

                                                  i don have except one ytplayer which is created dynamically with the code in the first post that i have posted and i got no any other ytplayers on stage. and i am sure of that. maybe sumthing wrong with main code (in first main post)??

                                                   

                                                   

                                                  thanks for fast reply

                                                  • 23. Re: AS2 problem
                                                    kglad Adobe Community Professional & MVP

                                                    then you're doing something very screwy because ytPlayer's depth is 1 in the code you showed and it's -16375 when button_music is released.  -16375 is the expected depth of an object placed on-stage.

                                                     

                                                    you can try:

                                                     

                                                    button_music.onRelease = function() {

                                                    _root.ytPlayer.swapDepths(_root.getNextHighestDepth());

                                                    trace(_root.ytPlayer.getDepth());

                                                    _root.ytPlayer.removeMovieClip();

                                                    gotoAndStop(12);

                                                    };

                                                    • 24. Re: AS2 problem
                                                      maxwel11 Level 1

                                                      traced coded

                                                       

                                                       

                                                       

                                                      *** Security Sandbox Violation ***
                                                      SecurityDomain 'http://s.ytimg.com/crossdomain.xml' tried to access incompatible context 'http://www.youtube.com/crossdomain.xml'
                                                      1
                                                      

                                                       

                                                      something strange while experiencing with the music button after changed code to urs found that when i press on music button 2 times the youtube player disappear/ removed. lol what that means?? any conclusions?

                                                      • 25. Re: AS2 problem
                                                        kglad Adobe Community Professional & MVP

                                                        you have more than one movieclip named _root.ytPlayer.

                                                        • 26. Re: AS2 problem
                                                          maxwel11 Level 1

                                                          and what do u think i should do to fix that??? cuz i am sure i got no on stage movie clips with name ytplayer. maybe the dynamic function of _root.createEmptyMovieClip("ytPlayer", 1); duplicate the movie clips??? or what?

                                                           

                                                           

                                                          thanks you ver much

                                                          • 27. Re: AS2 problem
                                                            kglad Adobe Community Professional & MVP

                                                            if _root.createEmptyMovieClip("ytPlayer", 1) repeatedly executes, there will still only be one ytPlayer and it will be at depth 1 on the _root timeline.

                                                             

                                                            toggle-on only the 2nd toggle in movie explorer, and enter ytPlayer in the "find" field and take a screenshot showing movie explorer.  attach the screenshot here.

                                                            • 28. Re: AS2 problem
                                                              maxwel11 Level 1

                                                              searchresult.gif

                                                              Here.

                                                               

                                                              Thanks

                                                              • 29. Re: AS2 problem
                                                                kglad Adobe Community Professional & MVP

                                                                first, mark my message 21 as correct.

                                                                 

                                                                then double click ytPlayer listed in movie explorer and remove it from your stage.

                                                                 

                                                                finally, retest.

                                                                • 30. Re: AS2 problem
                                                                  maxwel11 Level 1

                                                                  rofl, so embarressed :S but yea u were true and yea had 2 movie clips there xD and working well now

                                                                   

                                                                  thanks alot man You helped tons xD

                                                                   

                                                                  i got another problem about another project can i post it here or new thread?

                                                                  • 31. Re: AS2 problem
                                                                    maxwel11 Level 1

                                                                    if i can continue asking about other problem of other project here in same thread/post or i can't please let me know.

                                                                     

                                                                    thanks in advance

                                                                    • 32. Re: AS2 problem
                                                                      kglad Adobe Community Professional & MVP

                                                                      you're welcome.

                                                                       

                                                                      start another thread for another topic.

                                                                      • 33. Re: AS2 problem
                                                                        maxwel11 Level 1

                                                                        http://forums.adobe.com/message/4275285#4275285

                                                                         

                                                                        my new discussion, its as3 prob

                                                                         

                                                                        wish to see u there xD

                                                                         

                                                                        thanks so much