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.

eZ debug

Timing: Jan 31 2025 01:32:15
Script start
Timing: Jan 31 2025 01:32:15
Module start 'layout'
Timing: Jan 31 2025 01:32:15
Module start 'content'
Timing: Jan 31 2025 01:32:16
Module end 'content'
Timing: Jan 31 2025 01:32:16
Script end

Main resources:

Total runtime0.9475 sec
Peak memory usage8,192.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0070 588.1328151.2109
Module start 'layout' 0.00700.0047 739.3438220.7031
Module start 'content' 0.01170.9350 960.04694,402.8594
Module end 'content' 0.94670.0008 5,362.90637.8516
Script end 0.9475  5,370.7578 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00410.4309160.0003
Check MTime0.00140.1508160.0001
Mysql Total
Database connection0.00070.070810.0007
Mysqli_queries0.849789.6747540.0157
Looping result0.00060.0673520.0000
Template Total0.885293.420.4426
Template load0.00230.239320.0011
Template processing0.883093.184620.4415
Template load and register function0.00140.147310.0014
states
state_id_array0.00180.191610.0018
state_identifier_array0.00180.191220.0009
Override
Cache load0.00190.1981190.0001
Sytem overhead
Fetch class attribute can translate value0.00180.188320.0009
Fetch class attribute name0.00240.252230.0008
XML
Image XML parsing0.00210.224120.0011
class_abstraction
Instantiating content class attribute0.00000.001330.0000
General
dbfile0.00320.3329160.0002
String conversion0.00000.000940.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 14
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs