Go Back   CodingForums.com > :: Client side development > Flash & ActionScript

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-24-2008, 09:11 AM   PM User | #1
hyk
New Coder

 
Join Date: Mar 2008
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
hyk is an unknown quantity at this point
Question need help urgently!!!!

Hi guys, i veri new to flash. I nid to do an moving image marquee, which nid to be submitted in 2 weeks time.

The version i using is flash mx professional 2004


Can anyone help mi out there????? with either tutorials etc. any help as long it works is greatly appericated


hyk is offline   Reply With Quote
Old 03-24-2008, 04:35 PM   PM User | #2
gnomeontherun
Senior Coder

 
gnomeontherun's Avatar
 
Join Date: Sep 2007
Location: Houston
Posts: 2,846
Thanks: 10
Thanked 238 Times in 229 Posts
gnomeontherun will become famous soon enoughgnomeontherun will become famous soon enough
Well there are tons of tutorials out there, but I don't think they would call it an image marquee. You need to check out this post with tons of tutorials to search through http://www.codingforums.com/showthread.php?t=126424.

Doing some work before you submit a question will tell us you are willing to do the work, and that you are actually stuck. Right now it sounds like you just want someone to do it for you, and that is not nice. Check out those tutorials, and if you find one that works for you and are having trouble, we can do more help then.

You should check the rules, I don't know if this is a work project or school project, but read the rules please. http://www.codingforums.com/rules.htm
__________________
jeremy - gnomeontherun
Educated questions often get educated answers, and simple questions often get simple answers.
gnomeontherun is offline   Reply With Quote
Old 03-25-2008, 02:28 AM   PM User | #3
hyk
New Coder

 
Join Date: Mar 2008
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
hyk is an unknown quantity at this point
Smile trying hard

Hi, sorry my last post sounds like i was lazy.. i tried doing the marquee by reading up the stuffs etc. attached below is the source code which i written. On the surface its looks fine but the marquee could not display all the pictures i put in another folder.

my post looks quite lengthy. Gtg, in the meantime while waiting for your replys i going to keep trying where i went wrong or i need to add in more codes

Cheers.
Attached Files
File Type: doc Source.doc (37.5 KB, 140 views)
hyk is offline   Reply With Quote
Old 04-03-2008, 04:42 AM   PM User | #4
hyk
New Coder

 
Join Date: Mar 2008
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
hyk is an unknown quantity at this point
Question auto-sizing the marquee pic

Hi, can anyone tell mi how to resize the marquee?? so that the pic will be the same height...

hyk is offline   Reply With Quote
Old 04-03-2008, 07:09 AM   PM User | #5
gnomeontherun
Senior Coder

 
gnomeontherun's Avatar
 
Join Date: Sep 2007
Location: Houston
Posts: 2,846
Thanks: 10
Thanked 238 Times in 229 Posts
gnomeontherun will become famous soon enoughgnomeontherun will become famous soon enough
First you should post your code in the post itself using the [ code ] brackets.

Second, you should post the actual FLA, so we can see it in action. Usually I work best when I can see the actual file instead of just the code. I get lost in the text.

I don't actually have time or the skill to sit here and try to read the entire code to figure out what it does, so if you would be so kind to post the fla I could be of more help. Thanks.
__________________
jeremy - gnomeontherun
Educated questions often get educated answers, and simple questions often get simple answers.
gnomeontherun is offline   Reply With Quote
Old 04-03-2008, 07:28 AM   PM User | #6
hyk
New Coder

 
Join Date: Mar 2008
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
hyk is an unknown quantity at this point
Question image marquee sizing

I sorry, i can`t realli put it in winzip file cos the place i doing my proj do not us to dl winzip, the nxt best thing i hav is winrar. but here is does not support...
If u having a veri hard time to try to understand, i veri sorrie




[
Code:
var logos:Array = []; // this array is used to load the images into the MCL 
var presentLogos:Array = []; //  used to load the images onto the .SWF file.
var loadedImages:Number = 0; // track loading
var totalImages:Number;	   //load the image and increment the loadedImages variable, then check to see if it equals to the number of total images

// logos_mc = instance name; A string that identifies the instance name of the new movie clip.
// 0 = depth, An integer that specifies the depth of the new movie clip.
this.createEmptyMovieClip("logos_mc", 0);			

//create 2 identical movie clips with logos because the 2nd movie clip
//needs to be right next to the first one while scrolling to prevent a gap.
//- To be able to scroll continuously.
logos_mc.createEmptyMovieClip("logos1_mc", 0);		
logos_mc.createEmptyMovieClip("logos2_mc", 1);		

//obtain verification of successful data loading
var logoList:LoadVars = new LoadVars(); 

//.onData - triggered before onload. - takes the content of the file.
logoList.onData = function(src:String)
{
	if (src == undefined) 
	{
		return;
	}

	// ensures we have "g" or "j" as the last character in the text file. for "jpg", "png" and "gif"...
	while (src.substr(-1, 1).toLowerCase() != "g" && src.substr(-1, 1).toLowerCase() != "f")
	{
		src = src.substr(0, src.length - 1);
if (src.substr(-1, 1).toLowerCase() == "g" || src.substr(-1, 1).toLowerCase()== "f")
		{
			break;
		}
	}
	
	// split the array "logos"  by a delimiter parameter. In this case, the delimier is \r\n.
	//\r = enter ; \n = new line. Used for windows OS.
	logos = src.split("\r\n");
	
	totalImages = logos.length; 
	loadImages();
};

logoList.load("logo.txt");

/*******************************************************************************/
/* Function: loadImages()                                                      */
/* 		This function will load the images via the MovieClipLoader.   		   */
/*      It will set the width of the images; x axis = y axis.                  */
/*      Images will be loaded into the presentLogo array                       */
/*      if the textfile is not found, it will return an error.                 */
/*																			   */
/* Parameter : presentLogos.push                                               */
/*		push is used here because there's no guarantee that all the specified  */
/*      image file in the textfile are there and can be loaded. there is a     */
/*      need to list the ones loaded and push the names of the mc's that have  */
/*      the images loaded on the array inside the onLoadInit function and not  */
/*      in the onLoadError function because those are the ones that            */
/*      cannot be loaded.   												   */
/*******************************************************************************/
function loadImages() 
{
	for (var i:Number = 0; i < totalImages; i++) 
	{
		for (var j:Number = 0; j <= 2; j++) 
		{
			// create the logo_mc
			var logo:MovieClip = logos_mc["logos"+j+"_mc"].createEmptyMovieClip("logo"+i+"_mc", i);
			
	//Create the instance of the MovieClipLoader Class
		var mcl:MovieClipLoader = new MovieClipLoader();
			
			// create a listener for the mcl object 
			// listenser is an object tt receives notification from an event that is triggered in a movie.
			var listener:Object = new Object(); 
			listener.id = "logo" +i +"_mc";
			
			// listener associated with the mcl
			mcl.addListener(listener); 
			
			listener.onLoadInit = function(mc:MovieClip) 
			{
			
             mc._width=mc._height=120; //the height and width is set to 120.
	mc._yscale=mc._xscale;    // set the Y axis and the X axis.
				
				
// .join = converts the elements in an array to strings, inserts the specified separator between the elements, concatenates them, and returns the resulting string.
// indexOf = searches the presentLogos array and returns the position of it.
				
                         if (presentLogos.join().indexOf(this.id) == -1) 
				
//push method allows the parameter inside paranthesis to add that value inside the specified array                   {
					presentLogos.push(this.id); 
					
				}
				// increase loadedImages by .5 and not 1 because the images are being loaded twice otherwise, it will double.
				loadedImages += 0.5;
				if (loadedImages == totalImages)
				{
					replaceMCs();
				}
			};
			
			//if there's an error loading the movieclip, it will return a string depending on what type of error.
			listener.onLoadError = function(mc:MovieClip, err:String, httpCode:Number) 
			{
				if (err == "URLNotFound") 
				{
// decrease totalimages by .5 and not 1 because the images are being loaded twice otherwise, it will double.
					totalImages -= 0.5; 
					
				if (loadedImages == totalImages) 
					{
						replaceMCs();
					}
				}
			};
			
			mcl.loadClip("images/" + logos[i], logo);
		}
	}
}



/*******************************************************************************/
/* Function : replaceMC()													   */
/*		This function will load the images into the presentLogos array.        */
/*		It will do a check to see if all the images are present.	 		   */		
/*		It will trace and display the result on the output panel. 			   */
/*		If it detects a missing image, it will cover up the blank space by     */
/*		loading the previous logo of the array.	It also sets the scrolling time*/
/*      if the tracking is successful, the presentLogos array will start       */
/*      loading at position 0 of x axis                                        */
/*******************************************************************************/	
function replaceMCs()
{
	// Logos start loading in the reverse order so in order to prevent this, this function is used.
	presentLogos.reverse(); 
	
	// trace and show on the output panel, the loaded logos in the presentLogos array
	// used only in debugging mode
	trace("\nlogos loaded:\n \n"+presentLogos+"\n");
	
	for (var i:Number = 0; i < presentLogos.length; i++) 
	{
		for (var j:Number = 1; j <= 2; j++) 
		{
			var container:MovieClip = logos_mc["logos"+j+"_mc"];
			var logo:MovieClip = container[presentLogos[i]];
			
			if (i == 0)
			{
		//images will start at position 0 at Xaxis.
				
                                 logo._x = 0;
			} 
			
	// else it will load the previous logo from the array.
			
else 
			{
				var prevLogo:MovieClip = container[presentLogos[i-1]];
				logo._x = prevLogo._x + prevLogo._width;
			}
		}
	}
	logos_mc.logos2_mc._x = logos_mc.logos1_mc._width;
	
	// scrolling function is to be called continuously 
	// setInterval does not stop until it's cleared.
	_root.scroll_int = setInterval(startScrolling, 20); 	
}

/*******************************************************************************/
/* Function : startScrolling()												   */
/*      This function is to allow the image to start scrolling                 */
/*      from right to left.                                                    */ 
/*      if images are being loaded into presentLogo array successfully,        */
/*      it will call this function to start scrolling.                         */
/*******************************************************************************/
function startScrolling()
{
	// move logos_mc 1 pixel left at each frame
	logos_mc._x--;
	if (logos_mc._x <=-(logos_mc._width/2)) 
	{
		logos_mc._x = 5;
	}
}
hyk is offline   Reply With Quote
Old 04-04-2008, 06:59 AM   PM User | #7
hyk
New Coder

 
Join Date: Mar 2008
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
hyk is an unknown quantity at this point
hi, will a screenshot do?
Attached Thumbnails
Click image for larger version

Name:	marquee.gif
Views:	132
Size:	49.2 KB
ID:	6211  
hyk is offline   Reply With Quote
Old 04-04-2008, 09:13 PM   PM User | #8
gnomeontherun
Senior Coder

 
gnomeontherun's Avatar
 
Join Date: Sep 2007
Location: Houston
Posts: 2,846
Thanks: 10
Thanked 238 Times in 229 Posts
gnomeontherun will become famous soon enoughgnomeontherun will become famous soon enough
Wouldn't just resizing the logos_mc to your size work?
__________________
jeremy - gnomeontherun
Educated questions often get educated answers, and simple questions often get simple answers.
gnomeontherun is offline   Reply With Quote
Old 04-07-2008, 03:26 AM   PM User | #9
hyk
New Coder

 
Join Date: Mar 2008
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
hyk is an unknown quantity at this point
Resizing u mean? i try it, but its looks the same. Is tiz the correct code which i provided?

Code:
mc._width=mc._height=120; 	  
mc._yscale=mc._xscale;
hyk is offline   Reply With Quote
Old 04-07-2008, 04:01 AM   PM User | #10
gnomeontherun
Senior Coder

 
gnomeontherun's Avatar
 
Join Date: Sep 2007
Location: Houston
Posts: 2,846
Thanks: 10
Thanked 238 Times in 229 Posts
gnomeontherun will become famous soon enoughgnomeontherun will become famous soon enough
Honestly I just don't understand what you are asking for help with. You appear to have written a fairly complete script yet you are asking for something basic. You need to help me here, what are you wanting to resize? You change the value of the sizes using _height and _width...
__________________
jeremy - gnomeontherun
Educated questions often get educated answers, and simple questions often get simple answers.
gnomeontherun is offline   Reply With Quote
Old 04-07-2008, 07:06 AM   PM User | #11
hyk
New Coder

 
Join Date: Mar 2008
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
hyk is an unknown quantity at this point
Sorrie. Mayb i nt clear enough with my explanation. I wanted to change all the images in the (white background) to b the of the same height. Is tt even possible? I tried using resizing software, but looks no different, tt y i wondered could it even be done. Pls correct mi if my view is wrong & confusing u again.


ps: sorrie for always confusing u in my posts though u geniuely trying to help me...
hyk is offline   Reply With Quote
Old 04-07-2008, 08:35 PM   PM User | #12
gnomeontherun
Senior Coder

 
gnomeontherun's Avatar
 
Join Date: Sep 2007
Location: Houston
Posts: 2,846
Thanks: 10
Thanked 238 Times in 229 Posts
gnomeontherun will become famous soon enoughgnomeontherun will become famous soon enough
Ok now I understand. You had been saying to change the size of the marquee, which I understood to be the entire window.

Code:
mc._height=120; //the height and width is set to 120.
mc._xscale=mc._yscale;    // set the Y axis and the X axis.
This might do it. Again I can't test anything so I'm not sure. If you can use WinRar, you can still zip a file. You just have to make sure you export a file as .zip instead. If this doesn't work please try posting the file itself in a zip (or if you are using Windows just right click on the folder and select Send To -> Compressed (zip))
__________________
jeremy - gnomeontherun
Educated questions often get educated answers, and simple questions often get simple answers.
gnomeontherun is offline   Reply With Quote
Old 04-08-2008, 03:37 AM   PM User | #13
hyk
New Coder

 
Join Date: Mar 2008
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
hyk is an unknown quantity at this point
Hi jeremy, if u dun mind calling mi calling u in short.

The image resizing i dun realli nid it now. The present tasks for I nid to do is firstly,( when the cursor touch the marquee the movement of the whole marquee will stop moving). Secondly ( the images when clicked will go to a website, the website muz be written in the same txt folder whrere i put the images names). btw, the mouse action izzt called mouseover? I was tinking of writing the .txt file in javascript & putting all the website names in it then saving it in .html file or . Do u tink can it be done??



The zipped folder is quite big for tiz forum 594kb. mostly the images folders.
hyk is offline   Reply With Quote
Old 04-08-2008, 03:59 AM   PM User | #14
gnomeontherun
Senior Coder

 
gnomeontherun's Avatar
 
Join Date: Sep 2007
Location: Houston
Posts: 2,846
Thanks: 10
Thanked 238 Times in 229 Posts
gnomeontherun will become famous soon enoughgnomeontherun will become famous soon enough
Jeremy is fine A mouseover is correct. logos_mc.onMouseOver would probably do it, and then you would want to write a function that would stop the marquee. Then onMouseOut you would start the marquee again.

You are splitting the .txt file up by searching the strings, so you should be able to use the same method but by using a different delimiter value to send the second value (the URL) into the array so it is associated with the image. Then you would have to add a property of 'onRelease' to the individual image clips with a getURL method to load the links.
__________________
jeremy - gnomeontherun
Educated questions often get educated answers, and simple questions often get simple answers.
gnomeontherun is offline   Reply With Quote
Old 04-08-2008, 04:20 AM   PM User | #15
hyk
New Coder

 
Join Date: Mar 2008
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
hyk is an unknown quantity at this point
So does tt means i cannot write the .txt ( images names file) in javascript? i can`t put the websites names in the .as file & muz put it in the .txt file.

if i misinterept wat u r saying, i quite sorrie. Cos i dun realli understand. Your explaination is too detailed
hyk is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:06 PM.


Advertisement
Log in to turn off these ads.