PDA

View Full Version : Ajax content loader not working for flash content



ynef
05-14-2010, 01:41 PM
Hello everyone, it's my first post :P

I found this:
http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm

And tried to implement it to my website but this doesn't load flash movies. No, I am not directly trying to load a .swf but a html website with a flash movie in it and it's not loading it :/

All other pages are loaded correctly so I don't think I'm doing something wrong?

jscheuer1
05-14-2010, 03:06 PM
Probably won't work. If by:


a html website with a flash movie in it

you mean a different domain, that won't work with or without Flash. AJAX will not work cross domain, period.

But even if it's on the same domain, Flash tags work differently than ordinary HTML code, often they're script generated too - scripts on AJAX imported pages are ignored. Even if the Flash object is hard coded on the page you want to import, it may not work properly once imported. At the very least, removing it and replacing it with other content may not stop the audio portion (if any) in some browsers.

Flash import is best done either with iframe or some sort of api designed for Flash.

ynef
05-14-2010, 06:44 PM
Thanks for the reply.

The files are in the same domain... it's just a normal flash movie embed inside a html normally (exported both swf and html in flash).

So... there's no way to do it?

Is there an ajax iframe or something? I am not familiar with ajax at all :(

You can check an example on my site ynef.net

As you can see the links are at the very bottom and they open exactly as I like them to open... is there another way to do this?

jscheuer1
05-15-2010, 03:34 AM
Well, I just tried this out and it appears to work (I substituted a Flash page for the Ferrari Page):

http://home.comcast.net/~jscheuer1/side/ajax_content_flash/

I admit my test was designed to succeed. As I say, there are many things that can go wrong when combining AJAX and Flash.

If you want more help:

Please post a link to a page on your site that contains the problematic code so we can check it out.

ynef
05-17-2010, 01:09 PM
Well for example I would like the main page to load this: http://www.ynef.net/Games/BlackBox/

jscheuer1
05-17-2010, 02:54 PM
The path to BLAC.swf is incorrect for the page you are importing it to. It should be:

/Games/BlackBox/BLAC.swf

Otherwise, it appears to work - that is it loads the object, just can't find the .swf file.

But there could be other issues. Ideally, the page with the Flash object on it should have virtualy no other code (the center tag is OK). This might not matter though unless you are concerned with details of validation for the 'top' page after import, or warnings that some browser's developer tools may give. The path certainly does matter, so change the object/embed as shown (in two places, scroll the code block to see the other spot):


<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="200" height="150" id="BLAC" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="/Games/BlackBox/BLAC.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#cccccc" /><embed src="/Games/BlackBox/BLAC.swf" quality="high" bgcolor="#cccccc" width="200" height="150" name="BLAC" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>

ynef
05-17-2010, 04:38 PM
It's working now. Thanks a lot for helping me!