# Attach jpeg from library?

**URL:** <https://forum.kirupa.com/t/attach-jpeg-from-library/22524>\
**Category:** Uncategorized\
**Created:** [June 5, 2003, 1:57am UTC](https://forum.kirupa.com/t/attach-jpeg-from-library/22524 "2003-06-05T01:57:46Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 5, 2003, 3:28am UTC](https://forum.kirupa.com/t/attach-jpeg-from-library/22524/21 "2003-06-05T03:28:17Z")

</div>

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/480.htm)  
[http://www.flashmagazine.com/html/509.htm](http://www.flashmagazine.com/html/509.htm)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 5, 2003, 3:35am UTC](https://forum.kirupa.com/t/attach-jpeg-from-library/22524/22 "2003-06-05T03:35:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 5, 2003, 3:37am UTC](https://forum.kirupa.com/t/attach-jpeg-from-library/22524/23 "2003-06-05T03:37:32Z")

</div>

actually it would be easier to see the fla

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 5, 2003, 3:41am UTC](https://forum.kirupa.com/t/attach-jpeg-from-library/22524/24 "2003-06-05T03:41:02Z")

</div>

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 😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 5, 2003, 3:43am UTC](https://forum.kirupa.com/t/attach-jpeg-from-library/22524/25 "2003-06-05T03:43:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 5, 2003, 3:46am UTC](https://forum.kirupa.com/t/attach-jpeg-from-library/22524/26 "2003-06-05T03:46:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 5, 2003, 3:50am UTC](https://forum.kirupa.com/t/attach-jpeg-from-library/22524/27 "2003-06-05T03:50:26Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 5, 2003, 3:51am UTC](https://forum.kirupa.com/t/attach-jpeg-from-library/22524/28 "2003-06-05T03:51:33Z")

</div>

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]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 5, 2003, 3:52am UTC](https://forum.kirupa.com/t/attach-jpeg-from-library/22524/29 "2003-06-05T03:52:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 5, 2003, 3:52am UTC](https://forum.kirupa.com/t/attach-jpeg-from-library/22524/30 "2003-06-05T03:52:58Z")

</div>

wait now that i apply your script i do

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 5, 2003, 3:54am UTC](https://forum.kirupa.com/t/attach-jpeg-from-library/22524/31 "2003-06-05T03:54:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 5, 2003, 3:54am UTC](https://forum.kirupa.com/t/attach-jpeg-from-library/22524/32 "2003-06-05T03:54:28Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 5, 2003, 3:55am UTC](https://forum.kirupa.com/t/attach-jpeg-from-library/22524/33 "2003-06-05T03:55:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 5, 2003, 3:59am UTC](https://forum.kirupa.com/t/attach-jpeg-from-library/22524/34 "2003-06-05T03:59:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 5, 2003, 3:59am UTC](https://forum.kirupa.com/t/attach-jpeg-from-library/22524/35 "2003-06-05T03:59:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 5, 2003, 4:16am UTC](https://forum.kirupa.com/t/attach-jpeg-from-library/22524/36 "2003-06-05T04:16:54Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 5, 2003, 4:20am UTC](https://forum.kirupa.com/t/attach-jpeg-from-library/22524/37 "2003-06-05T04:20:33Z")

</div>

i got it never mind _blush_

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 5, 2003, 4:22am UTC](https://forum.kirupa.com/t/attach-jpeg-from-library/22524/38 "2003-06-05T04:22:06Z")

</div>

but the scrolling wont work grrr

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 5, 2003, 4:23am UTC](https://forum.kirupa.com/t/attach-jpeg-from-library/22524/39 "2003-06-05T04:23:11Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 5, 2003, 4:29am UTC](https://forum.kirupa.com/t/attach-jpeg-from-library/22524/40 "2003-06-05T04:29:00Z")

</div>

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.

[Previous page](https://forum.kirupa.com/t/attach-jpeg-from-library/22524.md?page=1)

[Next page](https://forum.kirupa.com/t/attach-jpeg-from-library/22524.md?page=3)
