Setting masks with AS

What am I doing wrong?
I have a MC in my library with a linkage identifier of
"mask". And I have a bunch of MCs on my stage with a instance names
of line_0, line_1, line_2.... etc.
Somehow the mask it not getting set. What am I doing wrong?
for (var i:Number = 0; i < numOfLines; i++){
this.attachMovie("mask", ["mask_" + i],
this.getNextHighestDepth(), {_x:647, _y:1165});
this["line_" + i].setMask("mask_" + i);
Thanks a lot for any help!

I think the problem is with your attachMovie line,
specifically the second argument. That is where you pass in the
name of the newly attached clip. It doesn't need the array brackets
around it.
However your setMask line where you are passing in the name
of the recently attached mask clip will need them!
this["line_"+i].setMask(this["mask_"+i]);
That is because in that case you need to tell flash to look
inside the current timeline (this) and look for the item named
"mask_"+i. Get it? When you give the name, it only needs a string
for the name, because you are telling it where to attach with the
this before the attachMovie. But afterwords you have to tell flash
where to look so then you do need the array notation.
BUT, there is a shortcut that is very useful.
var curLine:MovieClip=this["line_"+i];
var
curMask:MovieClip=this.attachMovie("mask","mask"+i,100+i,{yourobject});
curLine.setMask(curMask);
By defining temporary variables to be your line and your
mask, you can make the code easier to read and manage. Notice the
first one I just use the same code you've got, but assign it to a
variable. This is escpecially good if you are going to use that
several times. I don't know about you, but I have trouble always
typing the square brakets, the quotes, the plus and the variable in
the right order without a type. In this case you type it once and
then use the much easier to read and type curLine over and over.
In the second line, I rely on a how attachMovie works. If you
look it up in the help files, there is a line where it will tell
you that attachMovie returns a reference to the movie it just
attached. In fact many methods return things and you can either
ignore them or use them if you need them. In this case I capture
that return and assign it to curMask. Then again, I can always be
sure that I've got the correct mask by using the simple curMask.
Tricky, huh?

Similar Messages

  • How can I fill mask with pattern?

    Hi
    Would you please help me? How can a add pattern to a mask? I drew a motion mask on video clip and now I want to fill it with pattern that I made in Photoshop and saved as PSD, what should I do? How can I fill mask with specific pattern?
    Thanks for any help

    AE doesn't directly support a pattern-fill like PS, so here's a workaround (as Mylenium suggested):
    Create a PS document and create a layer filled with the pattern required.
    Import the layer/PSD to AE and place in timeline.
    Place a copy of the masked layer above the Pattern layer.
    On the pattern layer, set the Track Matte to Alpha Matte.
    Read more here:
    http://livedocs.adobe.com/en_US/AfterEffects/8.0/WS3878526689cb91655866c1103906c6dea-7cf9. html

  • Masking with an object

    Hi
    I've been doing some masking with the clipping tool, but is there a way I can import 2 pngs and use the top one as a mask while the other animates underneath? I can't find anyway of doing this, so wondered if it was possible?
    Thanks
    Wayne

    Hi kingmonkey,
    I fear that the constraint is rectangular mask : http://forums.adobe.com/thread/1285275?tstart=0
    If you accept the pink area to be a rectangle : convert it to a symbol, setting its overflow property to hidden.
    If you then move the wave animation inside that new symbol, you have the effect of the animation being clipped by the rectangle.
    But sadly, this only works for a rectangle.
    Gil

  • Masking with brush problem

    Why in mask with brush set to white it makes parts erased with black reappear, but especially black isnt black anymore, with closer look I can see "tiles" of background....when I use Lasso tool on the same area and "delete" it while having set black color, the black on the image is "black" again...is there some way to get it "black" with brush too ?
    Maybe I searched wrong keywords or just didnt know what to search, but I didnt find anyone asking about this problem.
    Thanks

    Looking at your screenshot, I think it may be because you have your color settings to "Grayscale Slider".  If you are working on this image for the web you can change the color settings to "RGB Slider" or "CMYK Slider", for example.  Basically, as long as you have it set on "Grayscale Slider" you will only get grayscale colors.
    You can change this setting by clicking the dropdown in the Color tab in the upper right side of your screen.  See image below.  Let me know if this helps.

  • HT204053 I have another Apple ID from when I originally set up this iPod, now I can't reset it as I am also set up with Find My iPhone which may have been doen by mistake I have been in contact with Apple itself and they can't fix the problem so far

    i have originally forgotten my pass code for a new iPod Touch, now I have with Apple's help reset it to factory, my issue is due to the change in my Apple ID , the iPod will not  let me set it up under the new Id or the old one.I also have been set up with find my iPhone and I don't remember if I did this or not, could have been the grand children trying to help out. Any ideas or suggestions, I haven't even used this yet and I have owned it for 6months already. Really am disappointed that the process is so difficult to navigate.

    I have also noticed the same "problem".  I do not fully understand the impact of using the same ID on multiple computers and devices if I want to keep them all in sync.

  • HT204053 I share an iTunes account with my daughter, I just got an ipad and need to set up with my own I'd for iCloud sync  how can I keep my apps and music?

    I share an iTunes account with my daughter, I just got an ipad and need to set up with my own I'd for iCloud sync  how can I keep my apps and music?

    ColleenMcG wrote:
    You can continue to share the same iTunes account ID with your daughter and set up a separate iCloud account with a different ID.
    => is this a different iCloud account for each device?  I thought iCloud account ID had to match some iTunes account ID, for which we only have one i Tunes account?
    You need to set up a separate iCloud account for each person that does not want to share their iCloud data.  If you share an iCloud account with someone, any data you both sync with the shared account is merged, and you end up with each other's data on your device(s).  If, for example, you owned two devices and someone else in the family also owned two devices, you would both want your own iCloud accounts, and you would each set up your personal iCloud account on the two devices you own.  In other words, you want a separate iCloud account for each person to be used on the devices they own.  Each iCloud account has to have a separate Apple ID.  The ID does not need to be the same as the ID used for iTunes.  Many families perfer to share the same iTunes account/ID, but maintain separate iCloud accounts with different IDs to keep there data separated.
    ColleenMcG wrote:
    It does not need to be the same as the ID used for iCloud.
    => what ID, iTunes?  So I can have a separate iCloud account "only" ID which I also assume must be some [valid] email address?  The children currently do not have email accounts anywhere.
    Yes, I was referring to the iTunes ID not needing to be the same as the ID used for iCloud.  In order to set up an Apple ID your children will need to have a valid email address that can be verified by Apple.  Apple requires this so they have a way of contacting the owner if there is a problem with the account, such as when you may need to reset the password on the account.  When you set up the ID, Apple will send a verification email to this email account and you will need to click on the verificating link in the email to complete the process.  If they don't currently have an email account you can just set one up with gmail or another free email hosting service.  They don't have to use the account but you will need it to set up the ID.

  • HT202213 I have a new computer we set up with itunes home sharing. Can I add music to this new computer sync my iphone and ipod to it instead of the original computer. I'm not sure if it makes a difference if I have a different apple id than with our orig

    I have a new computer that we set up with itunes home sharing and I need some assistance. I also have my own apple id and would like to make the new computer the one I use for my music. Should I set up a whole new itunes library/account or still work with the home sharing?

    Correct. When you update via iTunes all synced media that is not in your iTunes library will be lost.
    As IO said before:
    You can redownload most iTunes pruchases by:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store
    I do not think it included audio books.

  • I have a IPhone 5 and Iphone 5s. Both are set up with the same account ID and running IOS 8.0.2. When the phones are connected to the same Wifi at home, both phones will ring when someone call in to one of the phone.  Anyway to solve this problem?

    I have a IPhone 5 and Iphone 5s, each phone is activited with a different service provider. Both are set up with the same account ID and running IOS 8.0.2. When the phones are connected to the same Wifi at home, both phones will ring when someone call in to one of the phone.  Hence you do not know exactly which line the caller called.  If you answered using the wrong phone, then anyone calling the other number will not get through.  Anyway to solve this problem?

    Hey David Koh TP,
    Thanks for the question. It sounds like your devices are set up to use continuity together. Specifically, it sounds like you are signed into the same Apple ID in FaceTime, and have iPhone Cellular Calls enabled. To resolve your issue, simply disable this setting:
    Connect your iPhone, iPad, and iPod touch using Continuity
    http://support.apple.com/kb/HT6337
    Turn off iPhone cellular calls
    To turn off iPhone Cellular Calls on a device, go to Settings > FaceTime and turn off iPhone Cellular Calls.
    Thanks,
    Matt M.

  • I want to Facetime my Ipad from my Iphone but they are both set up with the same Apple id.  Do I need to create a new id for one of them in order to facetime with the other?

    I want to Facetime my Ipad from my Iphone but they are both set up with the same Apple id.  Do I need to create a new id for one of them in order to facetime with the other?

    You should be able to call the iPad using your Apple ID from the iPhone. When calling from iPad use the iPhone's phone number to initiate the call.

  • My Apple TV was set up with a different Apple ID than I have for my ITunes Account.  In other words I have multiple Apple ID's.  How can get these accounts to sync up?

    My Apple TV was set up with a different Apple ID than I have for my ITunes Account.  In other words I have multiple Apple ID's.  How can get these accounts to sync up?

    If you wish to use home sharing then you need to setup the Apple TV under your ID.

  • I think things would have been better without this icloud mess......  someone help me like it again.   1). i have more than 1 account set up with icloud. so i deleted 1 account from the settings on my iphone to try and switch to the other account and ever

    i think things would have been better without this icloud mess......
    someone help me like it again.
    1). i have more than 1 account set up with icloud. so i deleted 1 account from the settings on my iphone to try and switch to the other account and everything became a huge mess. (on my iphone i LOST some of my contacts, all of my reminders are gone, and nothing is showing up on the ical on my iphone, and only some notes are showing).......
    2). everything is still shown on my macbook pro.... but when i tired to go and sync it..... nothing is transfering to my phone........
    3). when i log into the 2 icloud accounts i have with icloud(.com) nothing is showing up in there also......
    whats is going on..... this is a huge mess for me. i want to go back the way is was like 1-2 years ago. when you can just sync things from the computer to the phone and not have to go through icloud....... ive been struggling with icloud but today just me hate it to the max.
    ANY HELP ON HOW I CAN FIX ALL OF THIS.....
    THANK YOU VERY MUCH!

    the version im using is 10.7.5
    im not sure what you mean by you second statement. when i open those application on my macbook its on my macbook but when i sign into icloud. i have those option selected.
    maybe my problem is im using the wrong ID...... lol.
    is there away you can delete or change icloud accounts/ ID's???

  • From my iPad I can print wirelessly in my office, but how do I print remotely via the web through my HP ePrint printer.  It is set up with an email address but i don't know how to access it from my iPad.

    I can print wirelessly in my office from my iPad, but how do I print remotely via the web to my HP ePrint printer.  The printer is set up with an email access address but I don't know how to access it from my iPad.

    Read through this for some information on how to do this:
    http://www8.hp.com/us/en/support-topics/mobile-printing/how-to-print-mobile-devi ces-ipad-iphone.html

  • How-To Set Up with Uverse Gateway with Airport Extreme

    I just spent hours figuring this out so I thought it would be helpful to someone. Maybe, maybe not. My goal was to get Back to My Mac turned on...but this should also be how you set up your wireless network if you have both an Airport Extreme and a Uverse Gateway.
    As I was trying to setup BTMM, I got a "double NAT" error. To use BTMM, you have to use either Time Capsule or Airport Extreme, so that NAT has to be enabled. That meant I had to figure out how to turn off U-verse's. I looked through the settings but saw nothing about it. Several hours of research--and a useless support call to AT&T--I finally figured it out. Here's the configuration you need, in brief.
    On the Airport Extreme, under Internet > Internet Connections, Connection Sharing must be set to "Share a public IP address". Then under the NAT button, Enable NAT Port Mapping Protocol must be checked.
    Now, unless you doe rest of this configuration, you will get a double DHCP error. So, in the Uverse Gateway settings, you must do this:
    1. Under Wireless, click the option to DISABLE wireless. Click Save.
    2. Under Firewall, click the option with DMZ in the name. On this page, choose your Airport Extreme (whatever you named it). Then scroll down and choose the option that says "Allow All Applications (DMZPlus Mode)". Save that configuration. DO A HARD RESET ON THE AIRPORT EXTREME. Then that should enable a single NAT protocol and BTMM will be on its way. And your wireless network will be set up properly.

    Will the above method work on a set up with a Verizon Modem to a DLink wireless router to a Time Capsule?
    I know of no reason why it would not. Whenever there is another router ahead of the Time Capsule, the Time Capsule must be configured in Briddge Mode. My network has 4 routers. The "main" router is setup to handle DHCP and NAT and the other 3 routers are setup in Bridge Mode. No problems.
    Weird thing is Air Video set up tells me I have a double NAT
    Double NAT occurs when you have two routers on a network both set up to handle DHCP and NAT services. Your Verizon "modem" may be a gateway....a combination modem/router on the same chassis. If that's the case, then every other router on the network must be confgured as a "Bridge".
    If you have the "main" router on the network setup to handle DHCP and NAT, in theory, you can have multiple other routers on the network as long as they are all setup in Bridge Mode. In Bridge Mode, DHCP and NAT are turned off, so the other routers simply pass through the network information from the main router. It's by far the easiest way to configure multiple routers without having to go into special DMZ, port mapping, etc type of configurations.

  • Good morning! i'd like to know why when I write an email in Mail, it creates numerous copies each second which fill the trash box. My email is set up with IMAP and is a gmail account. Thanks

    good morning! i'd like to know why when I write an email in Mail, it creates numerous copies each second which fill the trash box. My email is set up with IMAP and is a gmail account. Thanks

    Open Mail preferences and select Accounts then MailBox Behavior. You probably need to unclick the safe draft to server.

  • I have my iphone 5 set up with Itunes on one computer, but I recently just bought my own computer. How do I set up my Iphone with the new Itunes account? Its telling me it can only be set up with one account. Do I have to delete the other account?

    i have my iphone set up with itunes on one computer, but i recently bought my own computer. How do I set up my iphone with the new itunes account? It says my phone can only be set up woth one itunes account. How do I remove the previous account?

    ThisGal_Drea wrote:
    i have my iphone set up with itunes on one computer, but i recently bought my own computer. How do I set up my iphone with the new itunes account?
    Do you mean iTunes library?
    iTunes account is what you use to make iTunes purcahses.
    iTunes library is what is on your computer.
    It says my phone can only be set up woth one itunes account. How do I remove the previous account?
    No, it tells you it can only be sync'd with one iTunes library.
    Simplest way is to copy the entire /Music/iTunes/ folder (thisis the iTunes library) from old computer to new computer.

Maybe you are looking for

  • CS5.5 to CS6 free upgrade - Why can't I get a disk?

    I have been trying to convince someone in support at Adobe that we would like a hard copy disk of the CS5.5 to CS6 free upgrade, however they keep sending me a link to Creative Cloud even though I have talked to customer support until I am blue in th

  • Installing Windows Vista Ultimate 64 bit on Bootcamp issue

    Hi I'm a newbie, I would like to install Windows Vista Ultimate 64 bit using boot camp. I went into boot camp to partition and split the 1 terabyte hardrive. half is for Leopard, the other half is for Windows Vista. I followed the steps and popped in

  • 10g to 11g  import problem NETWORK_ACLS

    (I didn't mean to cross post this I just put it in the wrong place at first. it belongs here.. sorry 'bout that.) I'm uprading from 10 to 11g and have a problem importing. The table I'm trying to import has a trigger in it that uses the UTL_SMTP pack

  • The Hand Tool has stopped working

    I've noticed something odd recently. My mouse has been behaving weirdly. First of all, for about a week, mouse response in Logic was jerky and sluggish. Not enough for it to be a real issue, but annoying enough, what with all the crashing and all. Th

  • Canceled order, Where is refund?

    I just ordered a 100 page book, and right after I did it I cancelled it because I decided it was worth the extra 7 bucks to get it here faster. So I cancelled it and right after tried to order it again, but it said my credit card was declined, becaus