Age old ignored flash question

Author Message

Daniel Guerrier

Sunday 20 March 2005 4:04:33 pm

I've seen the same question ignored many times.
How can someone load data and images into flash at runtime. Getting it from a staight forward php page would be simple, but how is it done using ez?

Ben Peter

Sunday 20 March 2005 9:32:20 pm

Hi Daniel,

it should be rather straightforward, although I have not done it:

First, set up a page layout that delivers the data you want as xml. For that, add something like the following in layout.ini.append.php:

[flashxml]
PageLayout=flashxml_pagelayout.tpl

Create flashxml_pagelayout in your templates directory and see that it creates xml with the data you want. The following creates xml that makes the top level folders available:

<site-structure>
  {section var=node loop=fetch(content,list,parent_node_id,2,class_filter_array, array(folder))}
     <node url="{$node.url_alias|ezurl(no)}">{$node.name|wash}</node>
  {/section}
</site-structure>

From your Flash movie, you can access this data by retrieving /index.php/layout/set/flashxml/content/view/full

If you want to know the location of images, you can use ezimage in the xml creation to find out the paths.

I do not know how exactly you can process the xml in the Flash movie, but this is how I ususally provide dynamic data to those that do the flash, and it sounded like a fairly standard task when they talked about it.

If Flash insists on the Content-Type being text/xml, have a look at http://ez.no/community/forum/setup_design/generating_css_dynamically_setting_a_content_type to see how you can enforce that content type being sent.

Hope to help,
Ben

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.