473,386 Members | 1,924 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

HorizontalList of images from dynamic source

Hi Everyone,

As usual, after trying what I can, I come here to ask for your help.

Once I found out that scrollToIndex was not working in Flash, but it was working within Flex, then I started to learn Flex, so I'm a newbie.

I am trying to load an xml file into flex to populate a HorizontalList of images.

I am able to populate a datagrid using the same logic with no problem, but I have yet to be able to populate the HorizontalList, and the weird thing is that, I receive no errors during compile time. When I view the app in the browser, everything looks great except within the HorizontalList, all it displays is some text "Image10" -- what???

Here's the code:
Expand|Select|Wrap|Line Numbers
  1.     <mx:XML id="tempImageXML" source="http://www.mydomain.com/image_readerH.xml" />
  2.     <mx:XMLListCollection id="cuePointImageXMLList" source="{tempImageXML.row}" /> 
  3.  
  4.  
  5.     <mx:HorizontalList width="100%" height="100">
  6.  
  7.                     <mx:Image source="@Embed('http://www.mydomain.com/images/' +String({cuePointImageXMLList}))" width="50" height="50" />
  8.  
  9.     </mx:HorizontalList>
  10.  
Thanks in advance,
Tarik (Tah-Rick)
Nov 5 '07 #1
1 5642
OK, so I've changed the flex code to load an .swf file which can load pictures, but I'm having a hard time loading pics after the initial 25 jpegs load.

Expand|Select|Wrap|Line Numbers
  1.     <mx:VBox>
  2.         <mx:SWFLoader id="Load" source="@Embed(source='readfromdir4.swf')" height="150" width="100%"/>
  3.     </mx:VBox>
  4.  
I'm trying not to load all 6,000 images into the browser's at once, so I'm trying to do it 25 at a time.

Here's how I get the first 25:

Expand|Select|Wrap|Line Numbers
  1.  
  2. var filepath:String;
  3.  
  4. if (_url.indexOf("http") != 0) filepath = "http://www.mydomain/server/";
  5. else filepath = "";
  6.  
  7. var lv:LoadVars = new LoadVars();
  8. var pics:Array = [];
  9. var mcl:MovieClipLoader;
  10. var ipic:Number;                    // index into pics, used during loading
  11.  
  12.  
  13. // function to read returned list and push items into pics array
  14. function fillPicsArray(ok) {
  15.     if (ok) {
  16.         for(i=0;i<6000;i++)
  17.         {
  18.             pics.push(this["f"+i]);
  19.         }
  20. //        trace('the directory has ' + pics.length + ' pictures');
  21.         k=0;
  22.         for(j=myPrevNumber;j<myNextNumber;j++)
  23.         {
  24.             tempPics[k] = pics[j];
  25.             k++;
  26.         }
  27.         loadPic();
  28.     } else {
  29.         trace("problem with the script");
  30.     }
  31. }
  32.  
  33. // function to execute when each picture is loaded
  34. function onLoadInit(pic:MovieClip) {
  35.     pic._width = 50;
  36.     pic._height = 50;
  37.     pic._x = 8 + 66*ipic;
  38.     pic._y = 10;
  39.     pic._alpha = 100;
  40.     pic.filters = [picShadow];
  41.     if (++ipic < tempPics.length) loadPic();
  42. }
  43.  
  44. // function that loads one pic (as pointed to in the pics array by ipic)
  45. function loadPic() {
  46.     holder.createEmptyMovieClip("p"+ipic,ipic);
  47.     holder["p"+ipic]._alpha = 0;
  48.     mcl.loadClip("http://www.mydomain.com/images/" + tempPics[ipic], holder["p"+ipic]);
  49. }
  50.  
  51.  
That's fine, but I have tried all kinds of ways to try and load the next 25 images, but to no avail.

I know the values are there and I know that it is incrementing correctly, because I am placing the values into a textarea after I've clicked on the "Next 25" button. Here's the code for the next 25.

Expand|Select|Wrap|Line Numbers
  1.  
  2. var mcl2:MovieClipLoader = new MovieClipLoader();
  3. var ml:Object = new Object();
  4. ml.onLoadInit = function(target_mc:MovieClip) 
  5. {
  6.     target_mc._width = 50;
  7.     target_mc._height = 50;
  8.     target_mc._x = 8 + 66*ipic;
  9.     target_mc._y = 10;
  10.     target_mc._alpha = 100;
  11.     target_mc.filters = [picShadow];
  12. }
  13.  
  14.  
  15.  
  16.  
  17. myNext25btn.onRelease = function()
  18. {
  19.     this.createEmptyMovieClip("holder2", 1);
  20.     myPrevNumber += 25;
  21.     myNextNumber += 25;
  22.         k=0;
  23.         for(j=myPrevNumber;j<myNextNumber;j++)
  24.         {
  25.             tempPics[k] = pics[j];
  26.             msg_ta.text += tempPics[k];
  27.             mcl.loadClip("http://www.mydomain.com/images/" + tempPics[k], ml["p"+k]);
  28.             k++;
  29.         }
  30.         msg_ta.text += myNextNumber;
  31. }
  32.  
  33. myPrev25btn.onRelease = function()
  34. {
  35.     this.createEmptyMovieClip("holder", 2);
  36.     myPrevNumber -= 25;
  37.     myNextNumber -= 25;
  38.     fillPicsArray;
  39. }
  40.  
  41. function loadPic2(k)
  42. {
  43.     holder2.createEmptyMovieClip("p"+k,k);
  44.     holder2["p"+k]._alpha = 0;
  45.     mcl.loadClip("http://www.mydomain.com/images/" + tempPics[k], holder2["p"+k]);
  46. }
  47.  
  48.  
Thanks in advance :-)
Nov 6 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Henk Verhoeven | last post by:
(Reply on this newsgroup to an email - reply by email did not work) Wolfman wrote: > > Hi, > I found your Email in the php Newsgroup. > I was looking for some way to resize some graphiks on my...
5
by: K | last post by:
I have found a script online that I want to use (I am new to PHP). It creates dynamic images based on the text that you pass it. However, no matter how I try, I can't get anything other than a...
7
by: duncan.lovett | last post by:
I want to generate dynamic heading images, but I won't be able to use the GD Library, ImageMagick or any other plug-in to generate an image on the fly due to hosting restrictions. I have seen,...
1
by: Chris Nafziger | last post by:
In my code to send email from VBScript, I use standard CDOSYS code similar to the following: With oMsg Set .Configuration = oCon .To = """Admin"" <admin@mycompany.com>" .From =...
2
by: Tim | last post by:
I have an asp.net application that generates dynamic images (charts). When I run the application in debug mode from visual studio, or refer to the url with localhost in the name, everything works...
8
by: Chris Beall | last post by:
I'm struggling with how to handle, on a web page, images that contain text that the user must be able to read. Examples: tombstone photos, photos or scans of historic documents (handwritten or...
5
by: Glen Richards | last post by:
I've had no success in trying to dynamically set images at runtime in a Crystal Reports 9 report using C# 2005 Beta. I've been doing research along these lines & all the posts I've read say this...
2
by: boeledi | last post by:
Hello, I am developing in ASP.NET 1.1 (and unfortunately I am obliged to use 1.1). I need to generate images, using GDI+ and retrieve them on the web page, using AJAX. On the server side,...
1
by: richardgroen | last post by:
Hi all, I got one brainteaser (well...for me). I have a database with, lets say 100 images, these images are 'dynamic' e.g. it can be 100 but also 151 images. My question is: How can i...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.