A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: CLICK on an MC within an MC

  1. #1
    Junior Member
    Join Date
    Jun 2008
    Location
    Arkansas
    Posts
    7

    CLICK on an MC within an MC

    Hope this doesn't belong in the newbie forum!

    I'll try to explain my issue as well as I can, since I'm unable to upload the fla from here.

    I'm making a photo slideshow with clickable thumbnails. The thumbnails move in response to the position of the mouse, so I have all the thumbnails inside one horizontal bar-shaped movieclip (box2_mc). Each thumbnail inside that MC is an instance of one movieclip, named t1_mc, t2_mc, t3_mc, etc. There are 16 thumbnails, but only 8 coded so far. I'm using the following to interact with them:

    box2_mc.t1_mc.addEventListener(MouseEvent.CLICK, t1addPic);
    box2_mc.t2_mc.addEventListener(MouseEvent.CLICK, t2addPic);
    and so on.

    The odd thing is that the first 4 thumbnails will not respond when clicked at first. However, once I've clicked on one of 5-8 (which will respond), 1-4 become responsive.

    I've scoured the MC for invisible bogey-men blocking it, but to no avail.

    Is there an obvious solution here? Or, at least, is there something I could use to trace() back whatever I'm clicking on? More information needed? (curses to my lost thumbdrive or I'd upload the fla)

  2. #2
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    Can we see code for your addPic() functions? For starters - I'd say that you can save a lot of code by throwing all of those into a loop...you need some data structuring.

  3. #3
    Junior Member
    Join Date
    Jun 2008
    Location
    Arkansas
    Posts
    7
    Here's a copy of the fla and a txt with the pic adding function. It also has the initial function that puts photos up before any thumbs are clicked.

    I'm MORE than willing to take advice on structuring and efficiency. I'm very much a self-taught amateur, so my code is often pretty ugly. I haven't yet gotten a hold of many concepts (arrays, custom classes, XML, way more). A way of not having to copy/paste/find/replace over and over would be welcome.


    The two loaders are there so I can fade each pic in and out. Of course, the fadeIn functions aren't working consistently either, but that's next on my list of "make it work". I loaded the second picture with alpha=0 because I was getting a compiler error for the *LoaderContent variables inside any function that they weren't created in. This is incomplete, so the thumbnails are just blue shapes as placeholders.
    Attached Files Attached Files
    Last edited by monkeydoc; 01-07-2009 at 03:39 PM.

  4. #4
    Junior Member
    Join Date
    Jun 2008
    Location
    Arkansas
    Posts
    7
    Got that problem fixed. It was the obvious answer of something invisible blocking them. So I set the index of the first pics loaded to 0. I also got the fade function working and consolidated into just one function instead of having copied into every add function, and I also removed the excessive uses of "var" which seemed to be muddying things up.

    My current dilema has to do with the thumbnails pictures loading. The URLRequest is along the lines of (category+thumbNum+"thumb.jpg"). category is a variable so I can easily change the category of the slideshow (mat, pat, sen, and por are the different values I'll be putting in). I'm assigning that variable within the thumb_mc movieclip. I have the declaration of thumbNum inside the MC as follows: var thumbNum:Number=new Number().

    I'd like to assign a value to it from the stage. The instances (again, named t1_mc, t2_mc, etc) of this MC are within another MC (Box2_mc), so I assumed I would do it like this:

    Box2_mc.t1_mc.thumbNum=1

    And by calling a trace(thumbNum), it seems like it is working, but I'm still getting a URL Not Found message. If I replace the thumbNum variable with a 1, it works. If I put the thumbNum assignment inside the MC it works. It almost seems like it's trying to load BEFORE it gets that variable assignment.

    Any tips? And please pardon my horrible code habits, I'm working on it!
    Last edited by monkeydoc; 01-08-2009 at 01:43 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center