Professional Web Applications Themes

Reloading information into flash from MySQL - Macromedia Flash Data Integration

hey all, i am having an odd problem. I dont understand why it dont work (well der otherwise why would i be positng). Right.. well i am creating a dynamic photo gallery. The basics of it work well. The combo box is dynamically loaded from a php script that calls the MySQL DB and returns it in a string.... sorry if i am a bit slow and explaining every strep but only just learnt the loadVars bit today. The pictures are also loaded into flash through the same style. (different loadVars() thingy).. this works great the first time. but what ...

  1. #1

    Default Reloading information into flash from MySQL

    hey all,

    i am having an odd problem. I dont understand why it dont work (well der
    otherwise why would i be positng). Right.. well i am creating a dynamic photo
    gallery. The basics of it work well. The combo box is dynamically loaded from
    a php script that calls the MySQL DB and returns it in a string.... sorry if i
    am a bit slow and explaining every strep but only just learnt the loadVars bit
    today.

    The pictures are also loaded into flash through the same style. (different
    loadVars() thingy).. this works great the first time. but what i want to do is
    when they select an option on the combo box it requiries the DB through the php
    script and loads the new pictures up.

    I know the php script works as i build a quick html page to check the post and
    it does return only the required pictures when there is something in the post,
    and when there isnt it returns them all.

    but nothing is (seems) to be reloaded. i am not understanding where it is
    going wrong. any suggestions plz? I am hoping from looking at that the problem
    will be visible. i am sure thats where the problem lies as i tested the php
    script on its own.

    Thank you for your help in advance.

    Twiggy:o

    //loads in the combo box options
    headerLoader = new LoadVars();
    headerLoader.load("headers.php");
    headerLoader.ref = this;
    headerLoader.onLoad = function(success) {
    if(success) {
    for(var i=0; i < this.EOF; i++) {
    picid = this["catid"+i];
    name = this["name"+i];
    headers.addItem(name,picid);
    }
    }
    headers.rowCount = 10;
    }
    //loads in the pictures
    slideLoader = new LoadVars();
    slideLoader.load("slides.php");
    slideLoader.ref = this;
    slideLoader.onLoad = loadSlides;
    //in theory this should reload the pictures when combo box is used
    function reloadSlides(searchString) {
    slideLoader.search = searchString;
    slideLoader.sendAndLoad("slides.php",this,"POST");
    slideLoader.onLoad = loadSlides;
    }

    function loadSlides(success) {
    if(success) {
    for(var i=0; i < this.EOF; i++) {
    urlss = this["URL"+i];
    widthss = this["height"+i];
    heightss = this["width"+i];
    commentsss = this["comments"+i];
    namess = this["name"+i];
    slideNode = new Array();
    slideNode[0] = urlss;
    slideNode[1] = heightss;
    slideNode[2] = widthss;
    slideNode[3] = commentsss;
    slideNode[4] = namess;
    slides[i] = slideNode;
    }
    }
    else {
    picName.text = "up";
    }
    startSlideShow();
    }

    // Show the first slide and intialize variables
    function startSlideShow() {
    _global.max = slides.length;
    totalPicsNum.text = _global.max;
    _global.index = 0;
    picNum.text = _global.index+1;
    updateSlide(_global.index);
    }
    //
    // Updates the current slide with new image and text
    function updateSlide(pointer) {
    node = slides[pointer];
    imagePath = node[0];
    picName.text = node[4];
    picComment.text = node[3];
    imgwidth = Number(node[2]);
    imgheight= Number(node[1]);
    loadMovie(imagePath, targetClip);
    var x = ((((100-((imgwidth/swidth)*100)) / 2 ) / 100) * swidth);
    var y = ((((100-((imgheight/sheight)*100)) / 2 ) / 100) * sheight) + 18;
    _root.targetClip._x = x;
    _root.targetClip._y = y;
    testButtons();

    picName = slides.length;
    }

    //combo box code
    on(change) {
    reloadSlides(this.value);
    }

    TwistedTwig Guest

  2. #2

    Default Re: Reloading information into flash from MySQL

    1. What does the reloadSlides function do? That seems to be the one needed
    to evaluate.

    2. May not be the problem, but be sure the load method follows the onLoad
    handler in your code in both places. It is possible load could complete
    before the line is reached and thus the code for the onLoad event does not
    get processed resulting in random failed results.

    --
    Lon Hosford
    [url]www.lonhosford.com[/url]
    May many happy bits flow your way!
    "TwistedTwig" <webforumsusermacromedia.com> wrote in message
    news:dlr76s$ar$1forums.macromedia.com...
    hey all,

    i am having an odd problem. I dont understand why it dont work (well der
    otherwise why would i be positng). Right.. well i am creating a dynamic
    photo
    gallery. The basics of it work well. The combo box is dynamically loaded
    from
    a php script that calls the MySQL DB and returns it in a string.... sorry
    if i
    am a bit slow and explaining every strep but only just learnt the loadVars
    bit
    today.

    The pictures are also loaded into flash through the same style. (different
    loadVars() thingy).. this works great the first time. but what i want to do
    is
    when they select an option on the combo box it requiries the DB through the
    php
    script and loads the new pictures up.

    I know the php script works as i build a quick html page to check the post
    and
    it does return only the required pictures when there is something in the
    post,
    and when there isnt it returns them all.

    but nothing is (seems) to be reloaded. i am not understanding where it is
    going wrong. any suggestions plz? I am hoping from looking at that the
    problem
    will be visible. i am sure thats where the problem lies as i tested the php
    script on its own.

    Thank you for your help in advance.

    Twiggy:o

    //loads in the combo box options
    headerLoader = new LoadVars();
    headerLoader.load("headers.php");
    headerLoader.ref = this;
    headerLoader.onLoad = function(success) {
    if(success) {
    for(var i=0; i < this.EOF; i++) {
    picid = this["catid"+i];
    name = this["name"+i];
    headers.addItem(name,picid);
    }
    }
    headers.rowCount = 10;
    }
    //loads in the pictures
    slideLoader = new LoadVars();
    slideLoader.load("slides.php");
    slideLoader.ref = this;
    slideLoader.onLoad = loadSlides;
    //in theory this should reload the pictures when combo box is used
    function reloadSlides(searchString) {
    slideLoader.search = searchString;
    slideLoader.sendAndLoad("slides.php",this,"POST");
    slideLoader.onLoad = loadSlides;
    }

    function loadSlides(success) {
    if(success) {
    for(var i=0; i < this.EOF; i++) {
    urlss = this["URL"+i];
    widthss = this["height"+i];
    heightss = this["width"+i];
    commentsss = this["comments"+i];
    namess = this["name"+i];
    slideNode = new Array();
    slideNode[0] = urlss;
    slideNode[1] = heightss;
    slideNode[2] = widthss;
    slideNode[3] = commentsss;
    slideNode[4] = namess;
    slides[i] = slideNode;
    }
    }
    else {
    picName.text = "up";
    }
    startSlideShow();
    }

    // Show the first slide and intialize variables
    function startSlideShow() {
    _global.max = slides.length;
    totalPicsNum.text = _global.max;
    _global.index = 0;
    picNum.text = _global.index+1;
    updateSlide(_global.index);
    }
    //
    // Updates the current slide with new image and text
    function updateSlide(pointer) {
    node = slides[pointer];
    imagePath = node[0];
    picName.text = node[4];
    picComment.text = node[3];
    imgwidth = Number(node[2]);
    imgheight= Number(node[1]);
    loadMovie(imagePath, targetClip);
    var x = ((((100-((imgwidth/swidth)*100)) / 2 ) / 100) * swidth);
    var y = ((((100-((imgheight/sheight)*100)) / 2 ) / 100) * sheight) + 18;
    _root.targetClip._x = x;
    _root.targetClip._y = y;
    testButtons();

    picName = slides.length;
    }

    //combo box code
    on(change) {
    reloadSlides(this.value);
    }


    Motion Maker Guest

  3. #3

    Default Re: Reloading information into flash from MySQL

    thx for gettign back to me.

    i may not have explained my self very well... was late and i sometimes are a
    terrible code commenter. the reload funciton

    function reloadSlides(searchString) {
    slideLoader.search = searchString;
    slideLoader.sendAndLoad("slides.php",this,"POST");
    slideLoader.onLoad = loadSlides;
    }

    is supposed to be called when and only when the combo box on(change) method is
    envoked. it would pass in the value of the combo box selection to the method.
    then the variable searchstring should be attached to a post variable search
    that the php script could retrieve. the the sendAndLoad method should call the
    slides.php script telling it that theres the posted variable and the
    information should be passed back in. from what i have read that code just
    above this method should automatically be called, (i think... this could be
    where i am falling down)... and then it should re load the images with the
    method call

    //loads in the pictures
    slideLoader = new LoadVars();
    slideLoader.load("slides.php");
    slideLoader.ref = this;
    slideLoader.onLoad = loadSlides;

    loadSlides should set things up and redo the first pic and counters. i am
    aware i have some issues with the array.. ie if it went for 150 pics to 10
    there would still be all the old pics from 11 onwards... i think i would just
    need to create a new array each time loadSlides was called.

    am i way off base with my line of thinking here? bit confused

    thx Twiggy

    TwistedTwig Guest

  4. #4

    Default Re: Reloading information into flash from MySQL

    Sorry you did post it I just did not see it.

    The function LoadSlides really should be before the assignment to
    slideLoader.onLoad. This needs to be the case for all the onLoad
    assignments, the function needs to before the assignment.

    You cannot
    b = a
    a = 1

    and expect b to be 1.

    So you cannot expect

    slideLoader.onLoad = loadSlides
    loadSlides = function() ....

    and expect slideLoader.onLoad to be loadSlides.

    The order is reversed.
    loadSlides = function() ....
    slideLoader.onLoad = loadSlides

    So that above needs to be straighted out regardless if the real problem is
    more scoping or a logic error.

    To keep from going insane the easiest way to do this would be to declare the
    loadVars as a timeline variable. So just on a frame script. Then use
    function to call the sendAndLoad (and after the initial assignment of
    onLoad)

    myReceive_lv = new LoadVars()
    myReceive_lv.onLoad = function()
    {
    trace (myReceive_lv.var1)
    trace (myReceive_lv.var2)
    }
    mySend_lv = new LoadVars()

    Then functions on that same timeline can reference it

    slideLoader = function()
    {
    mySnd_lv.sendAndLoad("slides.php",myReceive_lv, "POST");
    }

    myBtn.onRelease()
    {
    mySnd_lv.var1 = ____
    mySnd_lv.var2 = ____
    slideLoader()

    }
    // Initial loading
    mySnd_lv.var1 = ____
    mySnd_lv.var2 = ____
    slideLoader()





    --
    Lon Hosford
    [url]www.lonhosford.com[/url]
    May many happy bits flow your way!
    "TwistedTwig" <webforumsusermacromedia.com> wrote in message
    news:dls8b2$d7t$1forums.macromedia.com...
    thx for gettign back to me.

    i may not have explained my self very well... was late and i sometimes are
    a
    terrible code commenter. the reload funciton

    function reloadSlides(searchString) {
    slideLoader.search = searchString;
    slideLoader.sendAndLoad("slides.php",this,"POST");
    slideLoader.onLoad = loadSlides;
    }

    is supposed to be called when and only when the combo box on(change) method
    is
    envoked. it would pass in the value of the combo box selection to the
    method.
    then the variable searchstring should be attached to a post variable search
    that the php script could retrieve. the the sendAndLoad method should call
    the
    slides.php script telling it that theres the posted variable and the
    information should be passed back in. from what i have read that code just
    above this method should automatically be called, (i think... this could be
    where i am falling down)... and then it should re load the images with the
    method call

    //loads in the pictures
    slideLoader = new LoadVars();
    slideLoader.load("slides.php");
    slideLoader.ref = this;
    slideLoader.onLoad = loadSlides;

    loadSlides should set things up and redo the first pic and counters. i am
    aware i have some issues with the array.. ie if it went for 150 pics to 10
    there would still be all the old pics from 11 onwards... i think i would
    just
    need to create a new array each time loadSlides was called.

    am i way off base with my line of thinking here? bit confused

    thx Twiggy


    Motion Maker Guest

  5. #5

    Default Re: Reloading information into flash from MySQL

    OMG thank you sooo sooo much!!!!

    that was the perfect fix. i see what was going wrong.. only thing i am just
    trying to fix is getting the change option on the combo box to work.. made a
    quick button and that worked great... over the moon.

    THX

    TwistedTwig Guest

  6. #6

    Default Re: Reloading information into flash from MySQL

    Super!

    --
    Lon Hosford
    [url]www.lonhosford.com[/url]
    May many happy bits flow your way!
    "TwistedTwig" <webforumsusermacromedia.com> wrote in message news:dlt49d$qft$1forums.macromedia.com...
    OMG thank you sooo sooo much!!!!

    that was the perfect fix. i see what was going wrong.. only thing i am just
    trying to fix is getting the change option on the combo box to work.. made a
    quick button and that worked great... over the moon.

    THX

    Motion Maker Guest

Similar Threads

  1. Export Querries from Flash 8 to MySQL and Import Datafrom MySQL
    By kelebribor in forum Macromedia Flash Data Integration
    Replies: 1
    Last Post: June 4th, 09:35 PM
  2. Stopping Flash from Reloading with PHP fails.
    By Kristen in forum Macromedia Flash Data Integration
    Replies: 0
    Last Post: July 29th, 06:17 PM
  3. Import MYSQL table information from .sql file
    By Brad Brevet in forum PHP Development
    Replies: 16
    Last Post: October 14th, 01:03 PM
  4. determine image information on image stored in MySQL BLOB
    By kristofl in forum PHP Development
    Replies: 2
    Last Post: October 4th, 01:22 PM
  5. Send data to Flash from a page without reloading the flash file
    By PoPsork webforumsuser@macromedia.com in forum Macromedia Flash Sitedesign
    Replies: 1
    Last Post: August 24th, 08:12 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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