Ask a Question related to Macromedia Flash Data Integration, Design and Development.

  1. #1

    Default php to flash

    I have a dynamic text instance in Flash named dynamic_txt and I want it to
    display information from a php file. What command allows me to do this? Here
    is the code:

    PHP

    <?php

    print "dynamo_txt=DYNAMIC";

    ?>

    ActionScript (2.0)

    var my_lv:LoadVars = new LoadVars();
    my_lv.onLoad = function(success:Boolean) {
    if (success) {
    //HERE IS WHERE I WANT THE COMMAND THAT WILL ALLOW DYNAMO_TXT TO DISPLAY THE
    STRING //FROM THE PHP FILE
    };
    my_lv.load("cars.php");



    budd101 Guest

  2. Similar Questions and Discussions

    1. Flash player not working on some websites & have foundRegestry keys of older Flash players.
      Hi, like many people here I have problems seeing flash content on some websites but other websites work fine. I also found that YOUTUBE works...
    2. Flash player installed, but every site flash playerrequired for asks to install not working at all
      Hi all, wondering if someone would be kind enough to help me, PLEASE lol Flash player asks to be installed everytime I go onto any site that...
    3. Javascript news ticker + Flash = shaking Flash inFirefox?
      I'm moving content (which I didn't develop) from an old site to my new design. I've run across a strange issue where a javascript menu appears to be...
    4. Calling on the Flash gurus!! How do I bring in a multi-page PDF into Flash?
      Hello, I think this may be new territory, well for me at least. I am trying to IMPORT a cable drawing package (PDF with over a hundred pages)...
    5. convert all flash site to both flash and no flash
      a friend has a site that is done with all flash. they asked me to help make it readable by more browsers. could some belly point me in the right...
  3. #2

    Default Re: php to flash

    Read my threads - you use LoadVars and put value-pairs into an array.

    Unfortunately, it was answered in AS 1.0/2.0 forum, not here so perhaps you
    didn't find it.

    //sqlcache
    /* fyi you can always create some valid test data locally by doing something
    like this:
    var mytest:LoadVars=new LoadVars();
    mytest.keyword10="keyword1"
    mytest.keyword11="organelle"
    mytest.keyword12="photosynthesis"
    mytest.keyword13="digestion"
    mytest.keyword14=""
    mytest.keyword15=""
    trace(mytest.toString())
    */

    var my_lv:LoadVars = new LoadVars();

    my_lv.onLoad = function (success:Boolean):Void {
    if (success) {

    //assuming _global.keywords is already defined as an array:
    //assuming _global.keywords might already have some keywords in it (otherwise
    this could be simpler)
    //create a temporary array:
    var tmpkeywords:Array =[];
    // Iterate over properties in my_lv
    for (var prop in my_lv) {

    if (typeof(my_lv[prop])=="string"){
    tmpkeywords.push(my_lv[prop]);

    }

    }
    trace("loaded in this order:"+tmpkeywords); //it is reversed, so:
    tmpkeywords.reverse(); //turn it around
    trace("reversed:"+tmpkeywords);
    //now assuming that the _global.keywords is already an array with some
    words... and we want to
    //add to the end:
    //the following 'function.apply' method lets the 'push' method take the
    elements of tempwords as an array an adds them individually
    _global.keywords.push.apply(_global.keywords,tmpke ywords);
    trace("global keywords now has:"+_global.keywords)


    } else {
    trace("Unable to load external file.");
    }
    }

    //make _global.keywords an array for testing:
    _global.keywords=["hello","world"];
    trace("global keywords starts with:"+_global.keywords)

    my_lv.load("sqlcache.txt");
    //sqlcache.txt

    GWD
    User is offline
    View Profile

    Senior Member Posts: 1927
    Joined: 06/24/2002
    Send Private Message
    03/11/2008 05:30:13 AM
    Reply | Quote | Top | Bottom

    You wouldn't usually want to or need to load the same data in twice.
    I checked the link to your swf and I couldn't see it attempting to load any
    external data via http activity. So I don't think this code is running in your
    full swf (or perhaps it's only after signing in etc?)
    Also, LoadVars automatically calls its own decode method by default, so you do
    not need to use 'decode' in the onLoad handler.

    Here's something which might help. Hopefully the comments etc, explain a
    little bit. The function.apply line is probably the one that might be a little
    difficult to comprehend. Its only there as a quick way to append the values to
    the _global.keywords array (assuming that you want append them).



    MYSCREENNAMEISUNAVAILABLE Guest

  4. #3

    Default Re: php to flash

    any insight in going the other way - from flash to php? - see my other post
    MYSCREENNAMEISUNAVAILABLE Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139