Loading images in a movieClip using PHP/MySQL

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

  1. #1

    Default Loading images in a movieClip using PHP/MySQL

    Loading images in a movieClip using PHP/MySQL
    I'm just starting to learn Actioncript, so this may be simple.
    I would be very happy if anyone could help me out.

    This is my code. It's OK, but I want more.

    //instance of movieClip called "imagecontainer" and path to where the image
    is
    imagefield_01.loadMovie("jpg/my_image01.jpg");

    //positioning the second movieclip containing the second image
    setProperty("_level0.imagefield_02", _x, 262);

    //instance of movieClip called "imagecontainer" and path to where the image
    is
    imagefield_02.loadMovie("jpg/my_image02.jpg");

    This is what I would like to find out:

    1. I'm storing the path of the image in a MySQL database. I'm using PHP to
    query the database.
    This is OK, but how do I get the value of the query in the Actionscript
    code?

    2. How do I position each image relative to the previous one? The challenge
    is that each image may have a different width than the previous and the
    next.

    3. My plan is to create a fixed number of movieclips. But is there a way to
    generate movieclips based on the number of images(paths) returned from
    PHP/MySQL?

    Thank you so much if you can help me!

    Nole


    Bjørn-Ole Schjølberg Guest

  2. Similar Questions and Discussions

    1. Embed images in one MovieClip, use in another?
      I apologize if you've already read this message. My question isn't only AS, not only Flash, not only Flex. It's in the mysterious area where the...
    2. Need help: Images, from an array, into a MovieClip by OOP
      Hi all, I have a big problem and I don't know how to solve it (I tried for hours but I'm new to actionscript). All of the following by OOP...
    3. loading a movieclip if and when needed
      hello. could someone please tell me how to load a movieclip from the library only if it is needed and therefore when it is needed. i've tried...
    4. loading and scaling an external SWF into a movieclip?
      Hi. I'm sure there's a way to do this easily with AS, but I don't know how. I'm trying to load an SWF into an empty movieclip instance. I've got...
    5. images not loading
      I've created a portfolio that works great when I create a regular Projector. But when I try to publish it and view the Shockwave file in a browser...
  3. #2

    Default Re: Loading images in a movieClip using PHP/MySQL

    Bjørn-Ole Schjølberg <bos@botanikus.net> wrote:
    > Loading images in a movieClip using PHP/MySQL
    > I'm just starting to learn Actioncript, so this may be simple.
    > I would be very happy if anyone could help me out.
    >
    > This is my code. It's OK, but I want more.
    >
    > //instance of movieClip called "imagecontainer" and path to where the image
    > is
    > imagefield_01.loadMovie("jpg/my_image01.jpg");
    >
    > //positioning the second movieclip containing the second image
    > setProperty("_level0.imagefield_02", _x, 262);
    >
    > //instance of movieClip called "imagecontainer" and path to where the image
    > is
    > imagefield_02.loadMovie("jpg/my_image02.jpg");
    >
    > This is what I would like to find out:
    >
    > 1. I'm storing the path of the image in a MySQL database. I'm using PHP to
    > query the database.
    > This is OK, but how do I get the value of the query in the Actionscript
    > code?
    You return the value as echo ("my_query_result=$my_query_result"); (You
    may have to url_encode or use utf8_encode to get it right in Flash, but
    PHP does whatever you need)
    >
    > 2. How do I position each image relative to the previous one? The challenge
    > is that each image may have a different width than the previous and the
    > next.
    If you want relative positioning, I suggest you get wharever property
    you need from the image you place related to (like:

    new_y_pos = _root.first_image._y+40;
    _root.second_image._y = new_y_pos;
    >
    > 3. My plan is to create a fixed number of movieclips. But is there a way to
    > generate movieclips based on the number of images(paths) returned from
    > PHP/MySQL?
    That should easily be accomplished by getting a result_count from php.
    >
    > Thank you so much if you can help me!
    >
    Your welcome. BTW: This isn't beginners stuff :)

    --
    Knut Einar Skjær
    [url]www.rsd.no[/url]
    knut einar skjær Guest

  4. #3

    Default Re: Loading images in a movieClip using PHP/MySQL

    Hello again. Thanks for replying.

    I'm still struggling with how to reference the variable in my script.

    I get a variable sent from the PHP scipt. This is OK. It is the right
    reference in the Flash file. I've tried to output the variable to a dynamic
    textfield and it shows the correct string. My challenge is to reference to
    this variable in the correct manner.

    If I get a variable like &imagename=../jpg/image.jpg from the php script. In
    the dynamic textfield only "../jpg/image.jpg" would appear. Instead of
    appearing in the textfield I'd like the variable to be the path of the
    image, but I don't know how to write this to get it right.

    Do I write:

    imagefield_01.loadMovie("imagename");

    or

    imagefield_01.loadMovie(imagename);

    or

    imagefield_01.loadMovie("&imagename");

    or som other way?

    Hope this explains better what I'd like to accomplish.

    Bjørn-Ole


    ""knut einar skjær"" <knut-einar@#ikkedette#rsd.no> skrev i melding
    news:1gmrs2g.1qa5ypyzs9mcoN%knut-einar@%23ikkedette%23rsd.no...
    > Bjørn-Ole Schjølberg <bos@botanikus.net> wrote:
    >
    >> Loading images in a movieClip using PHP/MySQL
    >> I'm just starting to learn Actioncript, so this may be simple.
    >> I would be very happy if anyone could help me out.
    >>
    >> This is my code. It's OK, but I want more.
    >>
    >> //instance of movieClip called "imagecontainer" and path to where the
    >> image
    >> is
    >> imagefield_01.loadMovie("jpg/my_image01.jpg");
    >>
    >> //positioning the second movieclip containing the second image
    >> setProperty("_level0.imagefield_02", _x, 262);
    >>
    >> //instance of movieClip called "imagecontainer" and path to where the
    >> image
    >> is
    >> imagefield_02.loadMovie("jpg/my_image02.jpg");
    >>
    >> This is what I would like to find out:
    >>
    >> 1. I'm storing the path of the image in a MySQL database. I'm using PHP
    >> to
    >> query the database.
    >> This is OK, but how do I get the value of the query in the Actionscript
    >> code?
    >
    > You return the value as echo ("my_query_result=$my_query_result"); (You
    > may have to url_encode or use utf8_encode to get it right in Flash, but
    > PHP does whatever you need)
    >>
    >> 2. How do I position each image relative to the previous one? The
    >> challenge
    >> is that each image may have a different width than the previous and the
    >> next.
    >
    > If you want relative positioning, I suggest you get wharever property
    > you need from the image you place related to (like:
    >
    > new_y_pos = _root.first_image._y+40;
    > _root.second_image._y = new_y_pos;
    >>
    >> 3. My plan is to create a fixed number of movieclips. But is there a way
    >> to
    >> generate movieclips based on the number of images(paths) returned from
    >> PHP/MySQL?
    >
    > That should easily be accomplished by getting a result_count from php.
    >>
    >> Thank you so much if you can help me!
    >>
    > Your welcome. BTW: This isn't beginners stuff :)
    >
    > --
    > Knut Einar Skjær
    > [url]www.rsd.no[/url]

    Nole Guest

  5. #4

    Default Re: Loading images in a movieClip using PHP/MySQL

    Nole <bos@botanikus.net> wrote:
    > If I get a variable like &imagename=../jpg/image.jpg from the php script. In
    > the dynamic textfield only "../jpg/image.jpg" would appear. Instead of
    > appearing in the textfield I'd like the variable to be the path of the
    > image, but I don't know how to write this to get it right.
    >
    > Do I write:
    >
    > imagefield_01.loadMovie("imagename");
    >
    > or
    >
    > imagefield_01.loadMovie(imagename);
    >
    > or
    >
    > imagefield_01.loadMovie("&imagename");
    You are very close to get this working! If you can see your variable in
    Flash, its just a matter of placing it right, and your done. Sounds a
    litle strange to me that you have the "&" attached to your variable, but
    that can be something in your php-script.

    Can you show me the code you've been using so far? As I told you, I
    think you almost got it, but its difficult to tell you where the problem
    is whithout seeing the code.

    --
    Knut Einar

    knut einar skjær 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