{"id":21,"date":"2004-09-28T13:36:38","date_gmt":"2004-09-28T19:36:38","guid":{"rendered":"http:\/\/blog.hotpepper.ca\/archives\/2004\/09\/database-integration-with-flash\/"},"modified":"2004-09-28T13:36:38","modified_gmt":"2004-09-28T19:36:38","slug":"database-integration-with-flash","status":"publish","type":"post","link":"https:\/\/siever.ca\/kim\/2004\/09\/28\/database-integration-with-flash\/","title":{"rendered":"Database Integration with Flash"},"content":{"rendered":"<p>I had a project I was working on that required me to import events from a database and import them into a Flash movie. After searching for a long time for a method that was easy and quick, I discovered <a href=\"http:\/\/tutorial26.easycfm.com\/\">Getting Data Into Flash<\/a> by Dennis Baldwin. <\/p>\n<p>Dennis\u00e2\u20ac\u2122 solution was exactly what I needed. Well, actually, not quite what I needed. His solution worked for getting the data from the database and importing it to Flash. That was the biggest hurdle. What it did not do was allow for importing separate records. So I modified it.<\/p>\n<p>The first thing I did was to modify his ColdFusion variable line into a sort of loop (make sure everything between the <code>cfoutput<\/code> and <code>cfset<\/code> tags are all on line).<\/p>\n<p><code><br \/>\n&lt;cfset x = 1&gt;<br \/>\n&lt;cfoutput query=\"qDates\" maxrows=\"5\"&gt;<br \/>\n&amp;eventDate#x#=#DateFormat(qDates.EventDate,'dd mmm')#<br \/>\n&amp;eventTitle#x#=#qDates.Subject#<br \/>\n&amp;eventTime#x#=#TimeFormat(qDates.Time,'HH:mm')#<br \/>\n&lt;cfset x = x+1&gt;&lt;\/cfoutput&gt;<br \/>\n<\/code><\/p>\n<p>The qDates query is the one that queries the database in order to pull the events I want. The maxrows attribute is how many events to return. If I only wanted three, I would change the \u00e2\u20ac\u01535\u00e2\u20ac\u009d to \u00e2\u20ac\u01533\u00e2\u20ac\u009d.<\/p>\n<p>What the above code does is creates a very long variable line that includes the date, title and time of five events.<\/p>\n<p>Now, we switch gears into ActionScript.<\/p>\n<p>I took the ActionScript on the container movie clip in Dennis\u00e2\u20ac\u2122 example and modified it to run another loop.<\/p>\n<p><code>onClipEvent(data) {<br \/>\n\ttotal = \"\";<br \/>\n\tfor(i=1; i&lt;6; i++) {<br \/>\n\t\teventDate = eval(\"eventDate\" + i);<br \/>\n\t\teventTitle= eval(\"eventTitle\" + i);<br \/>\n\t\teventTime = eval(\"eventTime\" + i);<br \/>\n\t\ttotal += eventDate + \" - \" + eventTitle + \", \" + eventTime;<br \/>\n\t}<br \/>\n}<\/code><\/p>\n<p>You will also noticed that I assign the variables to the container clip instead of the root. In addition, I needed to evaluate the three variables because of the addition of the use of the loop\u00e2\u20ac\u2122s index variable. If I had left it as <code>eventDate = \"eventDate\" + i;<\/code>  for example, it would not have recognised <code>\"eventDate\" + i<\/code> as a variable.<\/p>\n<p>Finally, I set the variable on my text field to be <code>_root.mContainer.total<\/code> so that it will import the values from the container\u00e2\u20ac\u2122s (in my case, I renamed container to mContainer) variables.<\/p>\n<p>There you go, a simple way to import multiple records from a database into Flash.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Dennis\u00e2\u20ac\u2122 solution was exactly what I needed. Well, actually, not quite what I needed. His solution worked for getting the data from the database and importing it to Flash. That was the biggest hurdle. What it did not do was allow for importing separate records. So I modified it.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1],"tags":[],"class_list":["post-21","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4NkW7-l","jetpack-related-posts":[{"id":7,"url":"https:\/\/siever.ca\/kim\/2004\/09\/02\/creating-vcs-files-in-coldfusion\/","url_meta":{"origin":21,"position":0},"title":"Creating VCS Files in ColdFusion","author":"Kim Siever","date":"2 September 2004","format":false,"excerpt":"One thing I have been trying for months to do on the Faculty of Management website is to create VCS files on the fly. VCS files are what Outlook and other calendaring software use to pass calendar items between each other. When I added an event to our database with\u2026","rel":"","context":"With 1 comment","block_context":{"text":"With 1 comment","link":"https:\/\/siever.ca\/kim\/2004\/09\/02\/creating-vcs-files-in-coldfusion\/#comments"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2960,"url":"https:\/\/siever.ca\/kim\/2017\/01\/14\/becoming-the-conquered-beast\/","url_meta":{"origin":21,"position":1},"title":"Becoming the Conquered Beast","author":"Kim Siever","date":"14 January 2017","format":false,"excerpt":"The knight, with sword drawn high, struck down with strength increased. Slayed the dragon, but \u2014 surprise \u2014\u00a0himself became the beast. Toward the sweetened fruit, led the rod so strait, But through the years, from rust and strain, became the building great. Shedded plate and shield to fling a fatal\u2026","rel":"","context":"In &quot;Faith crisis poetry&quot;","block_context":{"text":"Faith crisis poetry","link":"https:\/\/siever.ca\/kim\/category\/poetry\/faith-crisis-poetry\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/siever.ca\/kim\/wp-content\/uploads\/sites\/5\/2017\/01\/2880x1800_golden-dragon-dragon-mane.jpg?fit=1200%2C750&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/siever.ca\/kim\/wp-content\/uploads\/sites\/5\/2017\/01\/2880x1800_golden-dragon-dragon-mane.jpg?fit=1200%2C750&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/siever.ca\/kim\/wp-content\/uploads\/sites\/5\/2017\/01\/2880x1800_golden-dragon-dragon-mane.jpg?fit=1200%2C750&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/siever.ca\/kim\/wp-content\/uploads\/sites\/5\/2017\/01\/2880x1800_golden-dragon-dragon-mane.jpg?fit=1200%2C750&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/siever.ca\/kim\/wp-content\/uploads\/sites\/5\/2017\/01\/2880x1800_golden-dragon-dragon-mane.jpg?fit=1200%2C750&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":51,"url":"https:\/\/siever.ca\/kim\/2005\/03\/03\/google-maps-goes-north\/","url_meta":{"origin":21,"position":2},"title":"Google Maps Goes North","author":"Kim Siever","date":"3 March 2005","format":false,"excerpt":"It looks like Google has extended its map database north of the 50th parallel.","rel":"","context":"In &quot;Google&quot;","block_context":{"text":"Google","link":"https:\/\/siever.ca\/kim\/category\/google\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3027,"url":"https:\/\/siever.ca\/kim\/2016\/09\/22\/the-dying-fire\/","url_meta":{"origin":21,"position":3},"title":"The Dying Fire","author":"Kim Siever","date":"22 September 2016","format":false,"excerpt":"Humming bees, singing birds, the sun high in the sky. A burning fire, deep and old, within the heart did lie. A sojourn in the desert land, maturing of a rose. Returning home, out again, the grassland he had chose. There he planted, firm and sure, growing as an oak.\u2026","rel":"","context":"In &quot;Faith crisis poetry&quot;","block_context":{"text":"Faith crisis poetry","link":"https:\/\/siever.ca\/kim\/category\/poetry\/faith-crisis-poetry\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/siever.ca\/kim\/wp-content\/uploads\/sites\/5\/2017\/08\/embers-846853_1920.jpg?fit=1200%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/siever.ca\/kim\/wp-content\/uploads\/sites\/5\/2017\/08\/embers-846853_1920.jpg?fit=1200%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/siever.ca\/kim\/wp-content\/uploads\/sites\/5\/2017\/08\/embers-846853_1920.jpg?fit=1200%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/siever.ca\/kim\/wp-content\/uploads\/sites\/5\/2017\/08\/embers-846853_1920.jpg?fit=1200%2C800&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/siever.ca\/kim\/wp-content\/uploads\/sites\/5\/2017\/08\/embers-846853_1920.jpg?fit=1200%2C800&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":3227,"url":"https:\/\/siever.ca\/kim\/2018\/01\/24\/four-trees\/","url_meta":{"origin":21,"position":4},"title":"Four Trees","author":"Kim Siever","date":"24 January 2018","format":false,"excerpt":"Once there was an orchard small of four trees in a row. Planted by a gardener, from seedlings she did grow. Nurtured, pruned, and shepherded, a sight now to behold, Underneath their branches wide, four stories did unfold. Fruit upon the first was dark and light and soursweet. Life bestowed\u2026","rel":"","context":"In &quot;Heavenly Mother&quot;","block_context":{"text":"Heavenly Mother","link":"https:\/\/siever.ca\/kim\/category\/poetry\/heavenly-mother\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/siever.ca\/kim\/wp-content\/uploads\/sites\/5\/2017\/11\/forest-2984960_1920.jpg?fit=1200%2C731&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/siever.ca\/kim\/wp-content\/uploads\/sites\/5\/2017\/11\/forest-2984960_1920.jpg?fit=1200%2C731&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/siever.ca\/kim\/wp-content\/uploads\/sites\/5\/2017\/11\/forest-2984960_1920.jpg?fit=1200%2C731&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/siever.ca\/kim\/wp-content\/uploads\/sites\/5\/2017\/11\/forest-2984960_1920.jpg?fit=1200%2C731&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/siever.ca\/kim\/wp-content\/uploads\/sites\/5\/2017\/11\/forest-2984960_1920.jpg?fit=1200%2C731&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":71,"url":"https:\/\/siever.ca\/kim\/2005\/04\/04\/firefox-popup-improvements\/","url_meta":{"origin":21,"position":5},"title":"Firefox Popup Improvements","author":"Kim Siever","date":"4 April 2005","format":false,"excerpt":"Mozilla is revamping the pop-up feature for Firefox to disable Flash and JavaScript popups by default. Firefox can disable such popups, but the current version has that feature turned off due to concerns that it would interfere with legitimate popup windows that some sites use. A manual method of changing\u2026","rel":"","context":"In &quot;Browsers&quot;","block_context":{"text":"Browsers","link":"https:\/\/siever.ca\/kim\/category\/browsers\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/siever.ca\/kim\/wp-json\/wp\/v2\/posts\/21","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/siever.ca\/kim\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/siever.ca\/kim\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/siever.ca\/kim\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/siever.ca\/kim\/wp-json\/wp\/v2\/comments?post=21"}],"version-history":[{"count":0,"href":"https:\/\/siever.ca\/kim\/wp-json\/wp\/v2\/posts\/21\/revisions"}],"wp:attachment":[{"href":"https:\/\/siever.ca\/kim\/wp-json\/wp\/v2\/media?parent=21"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/siever.ca\/kim\/wp-json\/wp\/v2\/categories?post=21"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/siever.ca\/kim\/wp-json\/wp\/v2\/tags?post=21"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}