Attach jpeg from library?

It took me a while to get the hang of arrays, that was luckily in the Javascript days. Arrays are handled the same in AS as in Javascript… man was I glad for that.

Here are some great articles on arrays in Flash if you ever want to read up on them…

http://www.flashmagazine.com/html/480.htm
http://www.flashmagazine.com/html/509.htm

Theoretically this should work… however i see certain things that I don’t think belong anymore or things that I have not entered properly… tell me what you think doesn’t make sence

for (i=0; i<menuItems.length; i++) {
mc = container.attachMovie(imagearray*, imagearray*, i,{_x:0, _y:0, onPress:stopDrag, onRelease:stopDrag});
mc._y = i*(mc._height-1);
mc.movieToLoad = PICList*;
mc.actualButton.onPress = function() {
_root.pictures.loadMovie(this._parent.movieToLoad);
};
}

actually it would be easier to see the fla

LOL, you are going to kick yourself…

[AS]for (i=0; i<menuItems.length; i++) {}[/AS]

Well… uhh… menuItems doesn’t exist as an array anymore, you change the name…
[AS]for (i=0; i<imagearray.length; i++) {}[/AS]that is what you are looking for :wink:

check out the fla… it’s got that part… i must have screwed up in the cut and paste
and my but hurts from my kick

Oh hrm… I noticed your images don’t load in order. Odd. I see nothing wrong with the script.

the only things that look off is the 2 lines relating to the height

{_x:0, _y:0, onPress:stopDrag, onRelease:stopDrag});
mc._y = i*(mc._height-1);

I realize that the first line will make all the images load on top of each other
the second line I’m not so sure what it might do… it might adjust the _y of the new image loaded and offset it that much…
anyway the one thing that is buggion me is no images are loading at all.

Well I am stumped on the non-order thing, but other than that everything seems ok.

Although, I removed the ,{_x:0, _y:0, onPress:stopDrag, onRelease:stopDrag} part because I don’t think that will work in this situation.

[AS]for (i=0; i<imagearray.length; i++) {
mc = container.attachMovie(imagearray*, imagearray*, i)
mc._y = i*(mc._height-1);
mc.movieToLoad = PICList*;
mc.actualButton.onPress = function() {
_root.pictures.loadMovie(this._parent.movieToLoad);
};
}[/AS]

you say they load out of order… do you see images at all when you test movie? i don’t?

wait now that i apply your script i do

Image 10 is out of place. I don’t know why though.

the pictures themselves are various heiths… if I make them all a consistant heigth maybe that will fix the odd spacing…
now how do I make the button function work through a mask?

It should work fine through a mask… Although I just noticed you are using this._parent.movieToLoad, it should just be this.movieToLoad

Oh and yes, I recommend consistent sizes.

ahh heres the problem with making them a button

mc.actualButton.onPress = function() {
_root.pictures.loadMovie(this.movieToLoad);
};

actualbutton was the button in the orginal menu… now I have to convert it to imagearray* i think

Just do mc.onPress it should work fine. I had to target a button symbol previously because you had a rollOver effect. That isn’t the case here, so you can target the holder clip directly.

by the way Lost… I really appretiate all you’ve been doing. I can never say thanks enough… I bang my head off the wall with the little things i miss and the big things i don’t understand.

now attached is the site I am making for myself… in it is a menu and when you click on the top button “portraits” it should load the menu we just worked out and tried moving it into the “productmenu” movieclip in the library. I then launch it so it loads above the main menu but the pictures wont show… any ideas why they don’t?

i got it never mind blush

but the scrolling wont work grrr

***** mc = container.attachMovie(imagearray*, imagearray*, i)

it’s funny how the script works but where does container come into play?

  1. You gave your empty clip the instance name “container” and in the script you look for “picturemenu”, that is why the images don’t load. Change the

  2. The up/down buttons don’t work because when you attach the portraits clip you also set it to drag. This sets the main holder clip as a button, rendering all buttons inside it useless (since they are now buttons behind a button). So you will have to remove that part of the code.