View Full Version : [MX2004] Adding elements to array
julyknive
May 5th, 2005, 06:42 PM
When I simply add an element (jpeg) to an array it wont show when previewing, even though it gets traced.
Here's the deal:
this.pathToPeople = "images/photo/people/";
this.peopleArray = ["1_people.jpg", "bas1.jpg", "2_people.jpg", "3_people.jpg", "4_people.jpg", ];
for (var i=0; i <peopleArray.length; i++) {
trace(peopleArray[i]);
}
It's for my portfolio, and I wanted to update the photosection by adding "bas1.jpg" at index 1. So now when I preview it, bas1.jpg wont show up. (when browsing through the slideshow)
I also tried .splice() method, but even that wouldnt work. image wont show up. What am i doing wrong here?
julyknive
May 5th, 2005, 06:49 PM
But, when I duplicate one image, lets say
this.peopleArray = ["1_people.jpg", "4_people.jpg", "2_people.jpg", "3_people.jpg", "4_people.jpg", ];
then it will just show up?
And yes, bas1.jpg is in the right folder :)
eron19
May 5th, 2005, 06:56 PM
maybe you should try letting it load?!?? :D -maybe.
is it linked right? ?
julyknive
May 5th, 2005, 07:36 PM
linked to what sorry ?
vafer
May 5th, 2005, 07:41 PM
are you telling flash a path to your image, by loading "bas1.jpg" without telling it a path to the file on your computer flash will assume it is in the same directory as the FLA. Meaning if the images are in a sub folder you need to tell flash that ... "myFolder/bas1.jpg", etc.
julyknive
May 5th, 2005, 07:54 PM
vafer, notice the first line of code in the first post ;)
flash should just load that image, cause i have a preloader on that array.
but it wont load any image that i add (it used to though... :puzzled: )
vafer
May 5th, 2005, 08:03 PM
what version movie will you be outputing flash player 7 or flash player 6? The array handling is a bit different depending on the player you are targeting.
My bad for not reading that first line :).. been one of those days.
julyknive
May 5th, 2005, 08:09 PM
No worries, i feel you :)
I usually publish it in flash 6, but I tried 7 but that wouldnt work either..
maybe it's better if I put a .Fla online, not?
I think im just overseeing something.. since im still a baby-actionscripter :)
abcdefg
May 5th, 2005, 08:11 PM
this.pathToPeople = "images/photo/people/";
this.peopleArray = ["1_people.jpg", "bas1.jpg", "2_people.jpg", "3_people.jpg", "4_people.jpg"];
for (var i = 0; i < peopleArray.length; i++) {
trace(pathToPeople+peopleArray[i]);
}
Loosk like you forgot to actually add the path :)
vafer
May 5th, 2005, 08:12 PM
yea if your okay with posting the FLA do that... that will be the easiest way for me to tell what is going on.
The reason I asked about the player is if I set it to 7 there is an AS error if I did 6 the error goes away because 7 is particular in how you declare Arrays and such.
Oh and by not seeing the image you mean its not showing up on the stage or in your array? If its not on the stage then its a loading issue... and that explains why when you duplicate the image reference in the array the 2nd one appears.
julyknive
May 5th, 2005, 08:18 PM
digitalosophy, nice one, but i think it's more clarifying (in the output window) without the path in the trace method :)
vafer, i have second thoughts on posting my fla, i'll pm you a link ;)
vafer
May 5th, 2005, 08:20 PM
that's fine.
abcdefg
May 5th, 2005, 08:21 PM
digitalosophy, nice one, but i think it's more clarifying (in the output window) without the path in the trace method :)
vafer, i have second thoughts on posting my fla, i'll pm you a link ;)
I'm confused, i'll take a glance as well if you wish, i'm at work with nothing to do lol
vafer
May 5th, 2005, 09:49 PM
Good news it is just the image.
What program did you save the JPEG out in? I ended up having to go into photoshop and do the "save for web" feature with progressive unchecked and now the image works fine.
So there your AS is working with no troubles that's good news at least :).
julyknive
May 5th, 2005, 10:16 PM
aargghhh!! :)
you know what? i took those images from the wrong folder, indeed no web saved ones haha.. thanks for your time!!
sorry I edited your post by mistake - Digital
vafer
May 5th, 2005, 10:25 PM
hehe its fustrating I know.
just remember:
If the url your loading into a loadMovie() function is a JPEG image, it cannot be a .jpg file saved in progressive format
abcdefg
May 6th, 2005, 08:22 AM
I'm sure somewhere along the lines we've all done worse
i.e. like me editing your post instead of making a new one lol
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.