...

View Full Version : need help urgently!!!!



hyk
03-24-2008, 09:11 AM
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 :)


:(

gnomeontherun
03-24-2008, 04:35 PM
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

hyk
03-25-2008, 02:28 AM
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.
:thumbsup:

hyk
04-03-2008, 04:42 AM
Hi, can anyone tell mi how to resize the marquee?? so that the pic will be the same height...

:D

gnomeontherun
04-03-2008, 07:09 AM
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.

hyk
04-03-2008, 07:28 AM
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 :o




[


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
04-04-2008, 06:59 AM
hi, will a screenshot do?

gnomeontherun
04-04-2008, 09:13 PM
Wouldn't just resizing the logos_mc to your size work?

hyk
04-07-2008, 03:26 AM
Resizing u mean? i try it, but its looks the same. Is tiz the correct code which i provided?




mc._width=mc._height=120;
mc._yscale=mc._xscale;

gnomeontherun
04-07-2008, 04:01 AM
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...

hyk
04-07-2008, 07:06 AM
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...

gnomeontherun
04-07-2008, 08:35 PM
Ok now I understand. You had been saying to change the size of the marquee, which I understood to be the entire window.


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))

hyk
04-08-2008, 03:37 AM
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??

:confused:

The zipped folder is quite big for tiz forum 594kb. mostly the images folders. :p

gnomeontherun
04-08-2008, 03:59 AM
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.

hyk
04-08-2008, 04:20 AM
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 :p

gnomeontherun
04-08-2008, 04:39 AM
I'm also not quite sure what you were talking about with Javascript. Javascript doesn't really have much to do with Flash, they can communicate, but thats about it.

I suppose if you want to write the websites into a different TXT file you could, and then just import it the exact same way as the other. Then make sure the images and websites were paired correctly. So you would import the second TXT file and have a second array.

hyk
04-08-2008, 04:50 AM
Hi, mayb u can help me ( i hope :D) . ya putting the websites address in the same .txt file as the images. i read it can be done using xml, but i forbidden to use it.

attached is a .txt file whr the images is. btw if its possible to link both of them together, can u tell mi wat the syntax are to make it work?

Thanks

gnomeontherun
04-08-2008, 05:49 AM
Ideally you would use

image.jpg|www.website.com

and then split the values by the | sign. I'm afraid to give too much help since this is an assignment...

hyk
04-08-2008, 06:27 AM
Thanks i go try it out immediately. My assignment is like tt. Its okie for mi to find sources anywhere. The most impt thing its muz be able to work & i be able to explain how its works.

wow, juz putting a | will work. i tot we nid to add some more stuff in. :D

gnomeontherun
04-08-2008, 07:55 PM
Yes it can work if you write the code to support it properly.

hyk
04-09-2008, 02:58 AM
Hi jeremy,
i nt too sure if i follow your methods wrongly, can u pls help mi tk a look? Cos after i put 2 websites in the.txt file the images wun come out

Thanks:D

hyk
04-09-2008, 03:05 AM
:eek: I forgot to add in the attached txt file . :p

gnomeontherun
04-09-2008, 05:16 AM
Yes that is the way to make the text file. Now you will have to write the code for the actionscript to parse the text file.

hyk
04-09-2008, 06:10 AM
ic. Erm can you giv mi some hints or tutorials on how to write the code in as? :o

hyk
04-09-2008, 06:29 AM
oh ya, juz let u see my .fla file . The images is too large to transfer, if u wan see the images, pm mi with your email. :thumbsup:

gnomeontherun
04-09-2008, 07:33 AM
// 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");

This is the code used to split the text file by returns (its saying split each line of the file into an array).

Now we need to split the elements in the array into two. This isn't the most efficient method of doing all of this, but since XML isn't an option I guess its what we have to do.

This is untested but it should give you a start



imagesArray = new Array();
urlArray = new Array();
logosLength = logos.length-1;
for (i=0; i<logosLength; i++) {
splitArray = logos.split("|");
imagesArray[i] = splitArray[0];
urlArray[i] = splitArray[1];
}


Ideally, not sure its untested, but it should have two arrays created with images and urls. It takes the original array (logos) and splits each line up into a temporary array (splitArray), then puts the first part into imagesArray and the second into urlArray.

Again, I don't believe this is probably the best programming methodology. In theory it should work, and I don't have time to really figure out a better system right now.

hyk
04-09-2008, 08:01 AM
Jeremy, sounds like u quite busy, realli sorrie to keep bothering u :o.

Erm, still the same problem as juz nw, but mayb i put it in the wrong place.
i olso add in the | www.website.com in the .txt file

tk your time to do your stuffs 1st, i still gt a few wks be4 i nid to complete it. :D

gnomeontherun
04-09-2008, 09:14 PM
Its ok to keep asking questions, I just want you to try to do a little more work with the code. I'm going to challenge you to understand better the code first and then ask some specific questions.

The code you gave me was only the snippet I wrote, so I don't know where you put it. You should just have added it right after the split code.

This is meant to be something to learn from, not to have me tell you every step! I've given you a good start, so start by looking up in the actionscript documentation what these things do and understanding things for yourself.

I don't mind helping, but I do mind just solving people issues for homework without knowing if they are doing any real research or work. So I apologize if you are doing a lot of research on this, but if you have time to figure this out why not try and learn more?

hyk
04-11-2008, 02:05 AM
Hi, jeremy

Tiz link below is abit similar to the line of code u gave mi, but i was wondering the websites is hard-coded in as. so can it olso be used in the .txt ? :confused:

Another thing to ask about, is which part should i start with 1st? Cos i being experimenting with some codes regarding the URL, the marquee can run but when i click nothing happens.
Thanks in advance for clearing my doubts.

http://flashframer.com/actionscript-menu/

gnomeontherun
04-11-2008, 09:25 PM
the websites is hard-coded in as. so can it olso be used in the .txt ? :confused:

I'm not sure what you mean by Hard coded in as. Not to be rude, but I'm having trouble following some of your thoughts since your grammar/spelling is not like a natural speaker of English. (I totally understand and am glad you're trying, as I am learning German and will be working in a German city next year but don't speak it perfectly).


Another thing to ask about, is which part should i start with 1st? Cos i being experimenting with some codes regarding the URL, the marquee can run but when i click nothing happens.

I really just don't know what you are asking from me at this point. What are you doing exactly? Can't you change things in the .fla file? You can only pass things through the URL if they are designed to be accepted in the Flash document.

I think right now I'm just confused what works, what doesn't, and what needs to be added. Please be as clear as possible, for I don't even have your program files to work with so I am at a disadvantage.

hyk
04-14-2008, 01:53 AM
eh, sorrie. :o,


I think right now I'm just confused what works, what doesn't, and what needs to be added. Please be as clear as possible, for I don't even have your program files to work with so I am at a disadvantage.

I attach the fla & swf files for u to tk a look :)


For the 'hard coded' part, i meant the website must written in the .txt file & not in fla. ( not sure if i told u alr)

Erm, as for the 2nd part, I was wondering which part should i start doing 1st? (The stopping of the marquee when the mouse is on it) or (clicking the images den will link to a website)

:p ( sorrie for making u move about in circles)

hyk
04-16-2008, 04:02 AM
Hi again,

i still have some qns jeremy, I can control the start/stop of my marquee with my cursor already.

the last time i asked regarding the linking of the URL to the images, how should i go abt it?



ace.jpg | http:www.website.com


i tried using tiz line, but sadly it did not work, any advice? Thanks :)




loadVars.load(URL);
var myLoader:LoadVars=new LoadVars();
myLoader.load("website.txt");

hyk
04-18-2008, 05:37 AM
Hi jeremy

imagesArray = new Array();
urlArray = new Array();
logosLength = logos.length-1;
for (i=0; i<logosLength; i++) {
splitArray = logos.split("|");
imagesArray[i] = splitArray[0];
urlArray[i] = splitArray[1];
}

this few lines was what you told me, i have a qns though. from what i know, there should a getURL() function somewhere right?

gnomeontherun
04-18-2008, 06:52 AM
Ok, I'm sorry I"m confused by what you know and don't know about AS. You posted some complex code earlier, and are now stuck on getURL. The code that you quoted only pulls the information from the xml file into arrays. Then you'll have to use that information when you make the marquee.

As this is homework, I think I've given you plenty of guidance. Do you not understand the code that you are using? Where did you get it? Is this allowed for homework?

I don't mean to be rude, but your spelling and grammar is very difficult to understand, and has many errors. I don't mind helping, as I've said several times before, but you have to try to understand the code yourself as this is an ASSIGNMENT. If you need to better understand what arrays are, or what split() does, or what a for loop is, you need to read up on this.

I will not solve all of your issues on this, especially when I don't see an obvious effort to learn the code you have found somewhere.

hyk
04-18-2008, 07:24 AM
ic. Erm, the code was given to me by my teacher. The previous student had done the previous part, ( creating the marquee). Sorrie, I was very confused at the beginning part when the project was given to me at the start :)

As for the code, ya i understand much better now ( being reading up on flash) though i still have some doubts with the code (or why did the previous person write this & that).

the code i quote was for xml. but i am required to input the URL & the images names together in the same text folder, but xml is not allowed to be used in this project



Ace.jpg http://www,website.com


i tried methods like for example


onRelease=function()
getURL();


but i still unable to input the websites URL into the images.
maybe i still need to write in more stuffs etc

hyk
04-21-2008, 10:26 AM
Hi, i tried some of the commands that is related to linking external files, but i still did not solve my problem. Can anyone tell mi how to embed the URLs into the marquee. the URLs is in the same text folder as the names of the images. ( no xml pls) :)

Thanks in advance



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum