slide.mouseChildren = false;
On Mon, Apr 14, 2008 at 11:43 AM, Corban Baxter <[EMAIL PROTECTED]> wrote:
> Hey guys I am having some issues with understanding AS3 and how all my
> scope etc works. Can I get some type of explanation on this. Below is
> some code I am trying to use in my first AS3 project but I can't seem
> to get a few things to work out.
>
> The problem I see is that since my pictLdr is being put in the slide
> it inherits the slide's click event. But I don't want the pictLdr to
> have a click event I just want the slide (container) to have the
> event. When the pictLdr gets clicked now I am returned with a name
> value for the pictLdr but I only want the name of the slide since it
> will have the 'num' var in it and can tell me its position in the
> slide list. But pictLdr can't.
>
> I hope what I am asking makes sense. But I am slightly confused on all
> this. I understand why pictLdr is getting the event now since its part
> of the slide and with the new event model this is possible. But with
> my old AS2 mind I can't work around on how I am supposed to work
> through this. Please help! Thanks!
>
> function createSlides(slides:Array):void {
> var totalSlides:Number = slides.length;
> //trace(totalSlides);
>
> //create container to hold all the clips
>
> for (var i:int = 0; i < totalSlides; i++) {
> //trace(slides[i].num + " " + slides[i].pages[0]);
>
> var slide:SlideContainer = new SlideContainer();
>
> slide.x = 130;
> slide.y = -180 + (320 * i);//position slide along the
> y-axis
> slide.num = i;
> slide.name = "slide" + i;
> slide.buttonMode = true;
> slide.addEventListener(MouseEvent.CLICK, clicked);
>
>
>
> container.addChildAt(slide, i);//container for each of the
> slides and is a MC
>
>
> //this will hold additional info like a background for the
> images and a holder
> var pictLdr:Loader = new Loader();
> pictLdr.x = 22;
> pictLdr.y = 19;
> pictLdr.name = "img";
> slide.addChild(pictLdr);//code works fine if I addChild
> here.
>
> var pictURL:String = "gallery/" + slides[i].pages[0];//path
> to a jpg
> for the gallery
> var pictURLReq:URLRequest = new URLRequest(pictURL);
> pictLdr.load(pictURLReq);
>
> pictLdr.contentLoaderInfo.addEventListener(Event.COMPLETE,
> imgLoaded);
> }
>
> }
>
>
> function clicked(event:MouseEvent):void {
> trace(event.target.name); //returns img
> moveSlides(-1);
> }
>
> --
> Corban Baxter
> http://www.projectx4.com
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders