A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: creating a function for dynamic content

  1. #1
    Junior Member
    Join Date
    Apr 2004
    Location
    Phoenix
    Posts
    14

    creating a function for dynamic content

    hi,

    I ve got a question and hopefully someone can answer this, i am working on a photoablum newsletter thingy and after spending much of the night hard coding the values, i am sure that there is something amiss with the way i am doing this. I have read bits and pieces about creating functions to handle some of the repetative stuff and dynamically populating content on the stage.
    So my questions come down to this:

    1) i want to be able to have flash read a text/xml/db file to
    determine how many images are going to be added to the
    movie.

    2) I need to have flash populate my stage with the appropriate
    number of movie clips and assign the appropriate image to
    load once the thumbnail btn has been clicked.

    That should just about do it. If you would like to see what i am trying to do please point your browser here

    Once again i have hard coded all of this and my movie is way tooooo big for the dial up audience that i am sure to have for this. I appreaciate any and all help!

    cheers!
    we are all here to do, what we are all here to do.

  2. #2
    Abandon all Hope Inflicted's Avatar
    Join Date
    Aug 2003
    Location
    Harlem A+, Netherlands
    Posts
    296
    Is it too big because of the the images?
    What kind of gallery are you working with?

    questions... maybe I can help.
    regards

  3. #3
    Junior Member
    Join Date
    Apr 2004
    Location
    Phoenix
    Posts
    14
    correct you are, the images are too big, if you followed the link you would have noticed that when you click on a thumb the first time some of them take a bit to load up and your left w/ a blank screen area until the picture loads, which is just going to be ok once i add another dynamic loader to sit there and display while the image loads. but for the initial load up its gotta be tiny and using the external swf loading feature of loadMovie should help reduce initial download time.

    thanks!
    we are all here to do, what we are all here to do.

  4. #4
    Abandon all Hope Inflicted's Avatar
    Join Date
    Aug 2003
    Location
    Harlem A+, Netherlands
    Posts
    296
    So what is it you need advice on?
    regards

  5. #5
    Junior Member
    Join Date
    Apr 2004
    Location
    Phoenix
    Posts
    14
    1) i want to be able to have flash read a text/xml/db file to
    determine how many images are going to be added to the
    movie.

    2) I need to have flash populate my stage with the appropriate
    number of movie clips and assign the appropriate image to
    load once the thumbnail btn has been clicked.

    i hard coded everything rather than being able to change change it on the fly, so if i need to make changes i have to edit the original swf file, rather than say just change a text file and up load some new images.
    we are all here to do, what we are all here to do.

  6. #6
    Abandon all Hope Inflicted's Avatar
    Join Date
    Aug 2003
    Location
    Harlem A+, Netherlands
    Posts
    296
    Have you seen this:
    flash mx slideshow
    regards

  7. #7
    Junior Member
    Join Date
    Apr 2004
    Location
    Phoenix
    Posts
    14
    thanks but if you take a look at what i have already created you may have a better understanding of what i am asking. i want to use the format i created. i want to have all my thumbs dynamically brought onto the stage, along with the information needed to load the larger image once the thumb nail is clicked.

    could be i am not explaining this correctly but i think if you look at what i made you could probably see where i am trying to go with this.

    my example

    thanks
    Last edited by _root.loadMovie; 04-15-2004 at 05:01 PM.
    we are all here to do, what we are all here to do.

  8. #8
    Junior Member
    Join Date
    Apr 2004
    Posts
    19
    I think I'm doing something similar to what you want to do at the moment.

    My XML tage for an image looks like this:- (XML)
    Code:
    <image x="-45" y="20" url="scos\rallye.jpg" xscale = "200" yscale = "250">this creates an image</image>
    Here a small piece of how I read the XML data for image (after looping through the nodes, etc)
    Code:
    if(elementType == "image")
    	{
    	///call create image function
            CreateImage(elementTag.attributes.x,elementTag.attributes.y,elementTag.attributes.url, elementTag.attributes.xscale, elementTag.attributes.yscale);
    									}
    After looping through my XML document when I find the "image" node I take the atributes and send them to a function "createimage"

    The "createimage" function:-
    Code:
    function CreateImage(ImageXpos,ImageYpos,ImageUrl,ImageXscale,ImageYscale)
    {
    	dp = getNextHighestDepth();
    
    	
    	duplicateMovieClip(loader,"loader" + dp,dp);
    	eval("loader" + dp).contentPath = ImageUrl;
    	eval("loader" + dp)._x = ImageXpos;
    	eval("loader" + dp)._y = ImageYpos;
    	eval("loader" + dp).scaleX = ImageXscale; 
    	eval("loader" + dp).scaleY = ImageYscale; 
    	
    }

    I have an instance of the component Loader on my stage that I have called "loader" placed just out of view. The final function creates an instance of it and sets its location, scale and content etc. It all works in flash player 7 but wont work in 6 at the moment.
    - - - - - - - - - - - - -
    Any idea? Lost again!!!!!!
    - - - - - - - - - - - - -

  9. #9
    Abandon all Hope Inflicted's Avatar
    Join Date
    Aug 2003
    Location
    Harlem A+, Netherlands
    Posts
    296
    It looks to me your only problem is the size of your pictures. They should be between 50 and 100 kb and 72 dpi for the most.
    If you have a photo-editing program like Photoshop, this isn't too hard to accomplish.
    regards

  10. #10
    Junior Member
    Join Date
    Apr 2004
    Location
    Phoenix
    Posts
    14
    Caios,

    Thanks for your example, this appears to be very similar to what i am looking to acomplish, is there any chance you have a working copy I could check out?

    certaintly do appreaciate the help!
    we are all here to do, what we are all here to do.

  11. #11
    Junior Member
    Join Date
    Apr 2004
    Posts
    19
    I cant send you what I'm working on sorry. Its a complex application being made to be sold as a product. But if you post your email then, when I have some more time next week. I'll cut some of the code out and send it you working.
    - - - - - - - - - - - - -
    Any idea? Lost again!!!!!!
    - - - - - - - - - - - - -

  12. #12
    Junior Member
    Join Date
    Apr 2004
    Location
    Phoenix
    Posts
    14
    Caios,

    n/p i can relate. my email addy is jason@inkimplosion.com in the mean time i will see how i can manipulate what youv'e already shared. good luck on your project.
    we are all here to do, what we are all here to do.

  13. #13
    Junior Member
    Join Date
    Apr 2004
    Posts
    19
    Good luck with it. Let me know how you get on or if you have any problems. I've noted your email down and will send you something next week or so.
    - - - - - - - - - - - - -
    Any idea? Lost again!!!!!!
    - - - - - - - - - - - - -

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center