Loop to detect which mc an image was dragged into and snap image   to it

Hi All,
I have an 'onMouseUp' code that will snap a dragged image
into an mc target.
If I hardcode the target it works fine for that one mc
target, but if I
try to put it into some kind of loop to add the code for all
the mc
targets, it won't work.
If I hardcode it like it is, i get the trace "hello"
perfectly, if I put
it in a for loop, I get no "hello".
I could use a 'case' and hardcode all the eventualities, but
I was
wondering how I could do it more dynamically using a loop to
catch all
the mc targets.
Any help much apreciated,
Jeff C.
My code:
// constants
var NPICS:Number = 5; // number of pictures to load
var THUMBW:Number = 82; // width of each thumbnail
var THUMBH:Number = 82; // height
var MARGIN:Number = 10; // margin between thumbnails
_global.dragpic = ""; //name of pic being dragged
// index into pictures array, used for loading
var ipic:Number;
var thispic:String;
// set up loader, an instance of MovieClipLoader
var loader:MovieClipLoader = new MovieClipLoader();
// use the main timeline to listen to and respond to loader's
broadcast
events
loader.addListener(this);
var myMCL = new MovieClipLoader();//create an instance of
MovieClipLoader
function onLoadInit(_mc:MovieClip) {// this gets done when
the jpg is
completely loaded:
_mc._width = THUMBW;
_mc._height = THUMBH;
trace(_mc.getDepth())
_mc.onMouseDown = function(){
if (this.hitTest(_xmouse, _ymouse,true)) {
var nm:String = this._name
var nextDepth:Number = getDepth();
this.swapDepths(getNextHighestDepth());
this.startDrag(true);
_global.dragpic = this._name;
}//end of mousedown
_mc.onMouseUp = function(_mc){
this.swapDepths(nextDepth);
this.stopDrag ();
if(this.hitTest(tgt1)){// what target ** tgt1 is
hardcoded - want it dynamic!
trace("hello");
this._y = tgt1._y-(this._height/2);
this._x = tgt1._x-(this._width/2);
}//end of mouseup
function init() {
//create the targets for drop
for (var a:Number=1; a<=4; a++ ){ //loop to load 3
pictures
//attach targetmc and give each one the name tgt1, tgt2, etc
var mctg:MovieClip = this.attachMovie("targetmc", "tgt" + a,
100+a);
//position each one in a row -
//(border+(half width)) + (no of image) X (image
width+border)
mctg._x=(10+(mctg._width*.5)) + ((a-1)*(10 + mctg._width));
mctg._y=250;
//****end of targets code ****
// create holder for pictures
// make empty movieclips in thumbs_mc for each pic to go
into
for (var i:Number = 0; i < NPICS;) {
i++ //important to leave this out of the for()
var mc:MovieClip = this.createEmptyMovieClip("mc"+i, i+1);
if(i<4){
mc._x = MARGIN + (i-1)*(MARGIN + THUMBW);
mc._y = MARGIN;
if (i>3){ //start a new row after 3rd mc
mc._x = MARGIN + (i-4)*(MARGIN + THUMBW);
mc._y = (MARGIN*2) + THUMBH;
// set the pointer to the first jpg
thispic = "pic"+i+".jpg";
ipic = 0; //changes the x postion of pic
// start loading jpgs
loader.loadClip(thispic, "mc"+i);
//CALL THE INIT FUNCTION TO START THE MOVIE
init();

You are in recover mode.  You need to do what your iPad is telling you to do.  Connect it to your computer via USB and follow the instructions in the link I provided.  Be advised, recover mode often required you to do this multiple times to get it to work. 
http://support.apple.com/kb/HT1808

Similar Messages

  • My house was broken into and all my electronitcs were stolen.  How do I log into my Itunes account from a different computer?

    My house was broken into and all my electronics were stolen.  I want to be able to log in to my account from my work computer.

    Same way you logged into it from your computer.
    Open itunes, sign into your account.

  • My e-mail address was "hacked into" and a bogus email sent in my name---now I can't access my email because it won't accept my password.

    The email was sent at approx. 6:45 a.m. Tuesday to everyone in my address book. It stated that I was in Wales and had been mugged---all my cash, credit cards, and cell phone taken. My flight was supposed to leave in 6 hours, but the hotel wouldn't let me leave until I paid my bill. The email didn't give any contact information---so I'm assuming it was a "Trojan horse" to give a virus to everyone on my address list.
    Now, I can't open my email because it won't accept my usual password. Attempts to change my password have been unsuccessful. It says that I have not been properly identified to change my password.

    You will need to contact the customer services for the email service that was hacked and try to convince them that your account has been hacked.
    There are a number of ways that they get access to the password. One of the most common is by phishing, you are presented with a bogus site that looks like the login page for the email service/site and you enter your login details. This is frequently done by sending an email to you saying that you need to log into the site or need to confirm your details.
    To makes sure that your computer is not infected with malware, try running several malware scanners. It is best to run several as each will pick up things that the others miss. Some scanners you can try are:
    * [http://www.malwarebytes.org/mbam.php Malwarebytes]
    * [http://www.superantispyware.com/ SUPERAntiSpyware]
    * [http://www.lavasoft.com/products/ad_aware_free.php Ad-Aware]
    * [http://www.microsoft.com/windows/products/winfamily/defender/default.mspx Windows Defender]
    * [http://www.safer-networking.org/en/home/index.html Spybot S&D]

  • My old iPhone was hacked into and they were able to retrieve all of my deleted message. How can I permanently delete the messages?

    I had even restored my iPhone before this happened and the messages were still retrieved.

    I think you have serious issues here. It's not your iPhone only that was hacked but your iCloud and Keychain too.
    iCloud hack is where the danger comes from to you.
    You need to fix your iCloud issues by changing the password. Delete your whole key chain and generate new passwords using Safari, they are hard to crack.
    The weakest link in using key chain is the passcode on your device followed by the password to access key chain. These two basically give access to your data saved in the cloud.
    I strongly suggest that you speak to Apple about this, they are helpful and they take security seriously.

  • I deleted the url box in safari!  how do i get it back??  I think it was dragged into trash...but I deleted my trash!!!  Help me, please?

    I accidentally trashed the url box in safari and deleted it in trash!  how do I get it back?

    Right click on the toolbar and select Customize Toolbar, you can put it (and other things) back from the dialog box that you'll get

  • Help! My house was broken into and they stole my MacBook Pro

    How do I find my Mac without icloud?

    you can't.  But read this too: http://support.apple.com/kb/ht2526.  Also, see if your homeowners insurance may cover it.

  • Can you determine which secure zone you are logged into?

    Hi all,
    Is there a tag that tells you which secure zones you are logged into and display it on the screen. Or even javascript.
    Thanks

    Thanks Liam.
    I kind of worked out the you need to pull out the page id out of the URL and display it that way, but it fails if you have more than one page (you could check across all pages that are part of the secure zone I guess).
    Any other ideas would be appreciated.
    Anyway thanks again.

  • Is there a way to trace back an indesign document from which a certain jpeg was exported?

    I have a jpeg image that was exported from indesign a long time ago. I no longer know where the indesign file is located or it's name, but I need to edit the text of the jpeg and the only way to do that is by editing the original indesign document and reexporting it. Is there a way to trace back an indesign document from which a certain jpeg was exported?

    boshalosh wrote:
    I have a jpeg image that was exported from indesign a long time ago. I no longer know where the indesign file is located or it's name, but I need to edit the text of the jpeg and the only way to do that is by editing the original indesign document and reexporting it. Is there a way to trace back an indesign document from which a certain jpeg was exported?
    Depending on how the text interacts visually with the image, it might be possible to use the fill property of the content-aware deletion feature of recent Photoshop versions to remove the text with little or no evidence of the deletion, then apply text over the graphic however you like.
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices

  • I recently purchased a Mac 0S X 10.6.6 which was an upgrade from the Mac OS 1.4.1.1  I downloaded the adobe ph otoshop CS2 which I had on my old computer and now it cannot read my NEF files.  Which is a RAW file from my Nikon.  Can anyone help...please?

    I recently purchased a Mac OS X 10.6.6 which was an upgrade from my Mac OS version 10.4.1.1  I downloaded the Adobe Photoshop CS2 which I had on my old computer and now it cannot read my NEF files which is a RAW file from my Nikon D200.  I did not have this problem on my old Mac.  I always shoot RAW and can't open any photos.  Can anyone help me PLEASE?!? 

    Do you have access to another Mac to see if the disk can be read by it?  If it can't then you're pretty sure it's the disk. If it can then there may be issues with your optical drive which might be cleared up by using a cleaning disk on it, one that uses dry brushes (no liquid).
    If you have access to another Mac and it can read the iWork disk make a disk image of it so you can move the disk image to your iMac and install from the disk image.
    OT

  • Airport card not detected after s/w update was interrupted by power outage

    Hi Folks,
    My G4 was connecting to the internet thru a wi-fi AP at a B&B I am staying at. Bought the SP's access card from front desk and got online.
    Started updating software and the network went down due to a power outage.
    Since then was not able to get online as G4 refused to accept the DHCP address from the AP. Tried the latest security update for 10.3.9 and now the bluetooth and airport card are nopt detected even though the Sys Profiler says they are present.
    Dont think I need to re-seat the airport as nothing was physically wrong.
    Please Help! Is there a way out other than a reinstall of the OS ??
    Thanks,
    Powerbook G4 15"   Mac OS X (10.3.9)  

    Hi Don,
    There are aironet AP's installed all over the B&B. Just need to get connected to the n/w and start browsing. when one starts browsing the login page comes up which needs the info contained in the purchased card.
    Have not had a chance to do more as am relocating as part of a new job and have been very busy. So what you suggested at my end (not on AP end) has been done by default : )
    I also tried rolling back the system config to a previous backup. that helped recover the bluetooth and airport h/w. it was showing up and detected but the DHCP issue did not go away. I tried a complete reinstall (erase and install)of 10.3 and the DHCP issue is still there.
    now a self assigned IP is being used and for some reason the DHCP address is not being accepted/used by the laptop.
    everyone else in the B&B is doing well. and all are on windows
    is there anything else i could try??
    thanks,
    Powerbook G4 15" Mac OS X (10.3.9)

  • Detect which object is clicked out of several objects.

    I want to make a game where it randomly generates a map, and players can click objects of the map. I want something to happen to that object, and I want the game to detect which object has been clicked, and temporarily assign that object a name so that I can do things to that object, I want the name to overwrite when I click a new object, and want to be able to retreive what I have done to the other objects. Any help would be appreciated.

    Thanks, you pointed me in the right direction, here was my result:
    public var target
            public function DirtBlock() { //dirt block spawned
                trace("SPAWNED")
                this.addEventListener(MouseEvent.CLICK,fl_click)
             function fl_click(event:MouseEvent):void { //dirt block clicked
                var dirtblock:DirtBlock = new DirtBlock();
                trace("CLICKED")
                trace(event.currentTarget) //traces which object was clicked(Object, dirtblock)
                target = event.currentTarget// sets the object to "target" so it can be manipulated
                target.visible = false

  • Determining which page an image is on

    I am trying to replace all the images in a document with a different image. To do this, I am looping through all images in the document, getting the image bounds, determining which page the image is on, then using that information to create a textframe and place a new image. I am using this code to determine which page an image is on:
    pageImageIsOn = myImages[ imgNum ].parent.parent.parentTextFrames[0].parent.name;
    Sometimes, this gives the opposite page - I am not sure if it is giving the opposite page on the spread, or the wrong number because the textframe is linked to the page opposite on the spread.
    The textframes are created dynamically in earlier parts of the script.
    (the reason I am using this approach is that the original images are inserted in xml elements - they are placeholders - the replacement images are placed directly on the page)
    Thank you.

    Thank you - however, after experimentation, I think I need a different approach. Mixed facing pages is not the only obstacle. This is a toughy!
    What I am trying to do is use placeholder images in xml elements (placed during rule processing of an imported xml doc) to mark locations for other images that will be placed in a second pass. These new images will be chosen based on the tag content.
    I cannot place images based on content the first time through because they end up inside the xml element, and so cannot be floated in the margin.
    My first approach involved looping through all images in the document (myDocument.allGraphics) and replacing them based on the content info I recorded in the initial doc processing - this ALMOST works. Unfortunately, they are not exactly in the right order - sometimes, they are a bit off, especially when content spans multiple pages.
    I tried copying the placeholders into an array the first time through - however, the images in this array do not allow access of the page information via the heirarchy above.
    Is there another approach? Thanks again for helping.

  • I have just started to use Muse for our design agency and learning how to build ourselves a new site, I have manged to create a basic lightbox which contains sliding images, what I need to do now is have a pop up window which goes into detail about the pr

    I have just started to use Muse for our design agency and learning how to build ourselves a new site, I have managed to create a basic lightbox which contains sliding images, what I need to do now is have a pop up window which goes into detail about the projects, what I would like is a piece of text  or icon that when you roll over it and then click a separate window pops up with additional information in, once finished reading the info you can then click to close the box, any advice on how to do this?

    The best way to do what you're asking is with the Composition widget. Start with the Tooltip preset, which, by default shows the info on rollover. You can change the option to show on click, which is what you're after. You can also add the close button or have the info disappear on rollout.
    David

  • Hi, just need to know how to get my music, video, pictures and apps form my iPhone to my new laptop as the old computer, which I used before was stolen. I only have my phone left and if I try to conect it to my new laptop it's trying to delete everything.

    Hi, just need to know how to get my music, video, pictures and apps form my iPhone to my new laptop as the old computer, which I used before was stolen. I only have my phone left and if I try to conect it to my new laptop it's trying to delete everything.

    I have also noticed all my settings won't stay set, example....I removed the check mark from "third party cookies", the when I close Firefox and reopen the check mark is back, also my tool bar has screwed up....can't reset, been having trouble the up grade.

  • Can i use my time capsule to wirelessly backup my macbook and its external hard drive, which up until now was it's time machine and storage? How?

    Can i use my time capsule to wirelessly backup my macbook and its external hard drive, which up until now was it's time machine and storage? How?

    The external drive must be connected to the Mac using either USB or FireWire
    You must remove the external hard drive from the list of items that are "excluded" from backups in Time Machine Preferences.
    Here's how:
    Open System Preferences (gear icon on the dock)
    Open Time Machine
    Click Options
    Look for the name of the hard drive in the list of "excluded" items and click on it to highlight it
    Click the -- (minus) button at the bottom of the list to remove the hard drive from the list of "excluded" items....so it will now be backed up
    Strongly recommend that you do the first backup using Ethenret from your computer to the Time Capsule since the entire contents of the external drive will be copied on the first pass. Ethernet will be 3-5 faster than wireless.
    Once you have the first backup done, you can use wireless for subsequent backups since they will nornally be much smaller....unless you add large files to the external drive.

Maybe you are looking for