473,406 Members | 2,451 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,406 software developers and data experts.

Help with a function

I am in the process of building an Image Gallery. I have created an array "thumbs" and also a mc in my library called thumbnail (this has a UILoader and ProgressBar); I have sucessfully loaded the small images by creating a new thumbnail instance and storing it into an array. I have also created a Mouse Over EventListener onto each array element. My next goal is to have the mouse over call a specific picture. Right now it calls the image 1.jpg everytime.

The relevent functions are the loadThumb()
and loadPic()

does anyone have any suggestions/comments? This page can be viewed at www.jeanneflight.com/greg

Expand|Select|Wrap|Line Numbers
  1. stop();
  2. import fl.controls.ProgressBar;
  3.  
  4. var thumbs:Array = new Array();
  5. var i = 0;
  6.  
  7. function loadThumb(){
  8.     var mc:thumbnail=new thumbnail();
  9.     thumbs[i] = mc;
  10.     if(i % 2 == 0){
  11.         thumbs[i].x = 550;
  12.         thumbs[i].y = 100 + (i * 57);
  13.     } else{
  14.         thumbs[i].x = 633;
  15.         thumbs[i].y = 100 + ((i - 1) * 57);
  16.     }
  17.     thumbs[i].loader.load(new URLRequest("images/" + (i + 1) + ".jpg"));
  18.     addChild(thumbs[i]);
  19.     if(i < 9){
  20.         thumbs[i].pb.addEventListener(Event.COMPLETE, another);
  21.     } else {
  22.         thumbs[i].pb.addEventListener(Event.COMPLETE, function(evt:Event):void { thumbs[i].pb.visible = false; });
  23.     }
  24.     thumbs[i].addEventListener(MouseEvent.MOUSE_OVER, loadpic);
  25. }
  26.  
  27. //loadpic(1);
  28.  
  29. function loadpic(e:Event){
  30. var j = 1;
  31. mainImg_mc.pb.visible = true;    
  32. mainImg_mc.loader.load(new URLRequest("images/"+j+".jpg"));
  33. mainImg_mc.pb.addEventListener(Event.COMPLETE, function(evt:Event):void { mainImg_mc.pb.visible = false; });
  34. }
  35.  
  36. function another(evt:Event){ 
  37.     thumbs[i].pb.visible = false;
  38.     i++;
  39.     loadThumb();
  40. }
  41.  
  42. loadThumb();
  43.  
May 1 '08 #1
0 1378

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

Similar topics

7
by: Alan Bashy | last post by:
Please, guys, In need help with this. It is due in the next week. Please, help me to implement the functions in this programm especially the first three constructor. I need them guys. Please, help...
2
by: Jackson Yap | last post by:
can someone kind enough to help me look at the attached html and js file? Why is it that the javascript menu could not work at www.apchosting.net but could work at...
5
by: Craig Keightley | last post by:
Please help, i have attached my page which worksin IE but i cannnot get the drop down menu to fucntion in firefox. Any one have any ideas why? Many Thanks Craig ...
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
1
by: Michael D. Reed | last post by:
I am using the help class to display a simple help file. I generated the help file using Word and saving it as a single page Web page (.mht extension). I show the help file with the following...
1
by: Rahul | last post by:
Hi Everybody I have some problem in my script. please help me. This is script file. I have one *.inq file. I want run this script in XML files. But this script errors shows . If u want i am...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
4
by: Stef Mientki | last post by:
I'm making special versions of existing functions, and now I want the help-text of the newly created function to exists of 1. an extra line from my new function 2. all the help text from the old...
22
by: Amali | last post by:
I'm newdie in c programming. this is my first project in programming. I have to write a program for a airline reservation. this is what i have done yet. but when it runs it shows the number of...
1
by: Bob | last post by:
Hi, Hope you can help me with this one. I'm at my wits end. I'm trying to create an intelligent edit-box like the excellent "Customer" one at the URL: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.