Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP][Flash] Komunikacja PHP Z FLASH
klavius
post 8.04.2014, 19:02:26
Post #1





Grupa: Zarejestrowani
Postów: 20
Pomógł: 0
Dołączył: 22.12.2010

Ostrzeżenie: (0%)
-----


Witajcie,
Mam problem , a dokładnie tak jak kiedyś w as2 działało wszystko sprawnie tak teraz mam problem z odebraniem wiadomości z php.

Mam w as3:
  1.  
  2. function gets(){
  3.  
  4. var variables:URLVariables = new URLVariables();
  5. variables.username = "this_is_a_variable_that_is_being_sent";
  6. var request:URLRequest = new URLRequest("http://127.0.0.1/check.php");
  7. request.method = URLRequestMethod.POST;
  8. request.data = variables;
  9. var loader:URLLoader = new URLLoader();
  10. loader.addEventListener(Event.COMPLETE, completeHandler);
  11. loader.load(request);
  12. }
  13.  
  14. function completeHandler(event:Event) :void{
  15. textbox.text = event.target.data.response;
  16. trace(event.target.data.response);
  17. }
  18.  


a w PHP:

  1. <?php
  2. echo "response = ThisWasSentFromPHP";
  3.  
  4. ?>


I jak u "wszystkich" ten kod chodzi tak u mnie wywala mi:

  1. ReferenceError: Error #1069: Nie znaleziono właściwości response w String, a wartość domyślna nie istnieje.
  2. at Beznazwy_fla::MainTimeline/completeHandler()
  3. at flash.events::EventDispatcher/dispatchEventFunction()
  4. at flash.events::EventDispatcher/dispatchEvent()
  5. at flash.net::URLLoader/onComplete()



Naprawde próbowałem wielu opcji, i szukania na googlach ale nic nie działa. Jak nie powyższy błąd to wywala undefined . I tak w kółko, proszę o pomoc.
Go to the top of the page
+Quote Post
trueblue
post 8.04.2014, 19:09:30
Post #2





Grupa: Zarejestrowani
Postów: 6 799
Pomógł: 1827
Dołączył: 11.03.2014

Ostrzeżenie: (0%)
-----


http://help.adobe.com/en_US/as3/dev/WS5b3c...90204-7cfd.html
Sekcja: Loading data from external documents


--------------------
Go to the top of the page
+Quote Post
klavius
post 8.04.2014, 19:23:00
Post #3





Grupa: Zarejestrowani
Postów: 20
Pomógł: 0
Dołączył: 22.12.2010

Ostrzeżenie: (0%)
-----


Zastosowałem się do tego:

  1. function URLLoaderDataFormatExample()
  2. {
  3. var request:URLRequest = new URLRequest("http://127.0.0.1/check.php");
  4. var variables:URLLoader = new URLLoader();
  5. variables.dataFormat = URLLoaderDataFormat.VARIABLES;
  6. variables.addEventListener(Event.COMPLETE, completeHandler);
  7. try
  8. {
  9. variables.load(request);
  10. }
  11. catch (error:Error)
  12. {
  13. trace("Unable to load URL: " + error);
  14. }
  15. }
  16.  
  17.  
  18. function completeHandler(event:Event):void
  19. {
  20. var loader:URLLoader = URLLoader(event.target);
  21. trace(loader.data.dayNames);
  22. }



  1. <?php
  2.  
  3. echo "dayNames=lololol";
  4.  
  5. ?>



Wywala: undefined , Czy ja czegoś tam nie rozumiem?



EDIT:

Problem rozwiązany - przyczyną był po prostu zły adres, wsyatrczyło zamienić 127... na localhost - pomogło.

Ten post edytował klavius 8.04.2014, 21:05:50
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 12.06.2025 - 11:03