Flash Making AJAX Requests?
I don't really play with web stuff at all, but someone gave me a site template recently and I wanted to start playing with it. I apologize in advance if my terms are misguided.
The main top section of the site is a little Flash thing that has buttons as links to different areas of the site. 开发者_C百科All of that is well and good, but whenever I click those links, it has to reload the entire page (including the Flash app) when only the bottom part changes. This isn't really a huge issue, since everything's real small, but it's kind of annoying.
I vaguely remember "fixing" this behavior using AJAX during my web programming class, but that was just straight HTML and Javascript, no Flash players to muck around with.
My question is, how do I overcome having to reload the entire page when someone clicks a link from the Flash object? Is there some nice way I can call something other than getURL() to achieve this effect? I would prefer to not have to try and recreate that site's experience without the Flash ( but if I had some graphical ability, I would! ).
Thanks for any suggestions!
Flash has a nice thing called ExternalInterface. It allows you to call a JS method on the parent HTML page directly from your flash movie.
The format is something to the effect of:
ExternalInterface.call("myJSFunctionName", params:Object);
Or something to that effect, double check to get the exact format. That should let you handle your navigation directly in JS without refreshing your page every time.
hmmm... can you change the Flash object? would suggest changing the URLs on the link to plain javascript that would load the URL...
精彩评论