[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

fire PHP function in AS3/flash

Posted on 2011-03-02
9
Medium Priority
?
388 Views
Last Modified: 2012-05-11
ok i have a php function which creates thumbnails. i want to execute this function from my swf as3.

i have some code that works now but it only works the first time after the swf has been published. i'm guessing because it worked and is loaded but i cant get it to unload /work again.
the as3 fires in a button listener. what i need is to be able to hit that button as many times as needed.   i am new to both as3 and php so take it easy on me lol  i am stuck please help

my as3 code is

 function goURL() {
            var request:URLRequest = new URLRequest("myfile.php");  
            var loader:URLLoader = new URLLoader();  
                   loader.load(request);
 
0
Comment
Question by:conagraman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
  • 2
9 Comments
 
LVL 3

Expert Comment

by:wwwdeveloper2
ID: 35023480
Try this:

Add an event listener to button to call the function when it is clicked:

your_button.addEventListener(MouseEvent.CLICK,goURL);


In your function throw the event:MouseEvent in it:

 function goURL(event:MouseEvent)
{
            var request:URLRequest = new URLRequest("myfile.php");  
            var loader:URLLoader = new URLLoader();  
                   loader.load(request);
}

Hopefully this will get you heading in the right direction.
0
 
LVL 10

Author Comment

by:conagraman
ID: 35023597
thanks for the comment : )

 but i have already came that far.  
i wish it was that simple
0
 
LVL 3

Expert Comment

by:wwwdeveloper2
ID: 35023608
Ok, no problem.  I didn't realize you came that far.  Your example code looked incomplete and was missing proper syntax.

Good luck.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Author Comment

by:conagraman
ID: 35023622
i think i need eaither another way of loading/opening the php file or the solution will comefrom the loader class or urlrequest class
0
 
LVL 10

Accepted Solution

by:
conagraman earned 0 total points
ID: 35023798
got it.

i dont know if there is a way to do that the way i was trying.

what worked for me is passing a variable to the php. i was trying to avoid doing it this way because even though it may be the only way it seems kinda hacky when your not wanting to return anything. oh well as my boss would say .. it is what it is
0
 
LVL 39

Expert Comment

by:blue-genie
ID: 35024805
if you're happy that your problem is resolved please close your question.
if you require further assitance please post your full code to show how you're handling the php return values. etc
the php code might help as well.
0
 
LVL 10

Author Comment

by:conagraman
ID: 35026591
blue genie

i think i was just making some rookie mistakes.  part of the learning process i guess. as far as closing the q i thought i did but i guess it didnt take. ill try again. thanks
0
 
LVL 39

Expert Comment

by:blue-genie
ID: 35030474
np. glad you came right.
0
 
LVL 10

Author Closing Comment

by:conagraman
ID: 35067795
please close the q. i was able to gain a better understanding of what i was doing and was able to use the urlloader in the correct way. thanks to all who tried to help.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to dynamically set the form action using jQuery.
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question