To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Reply
 
Thread Tools Search this Thread Display Modes
Old 07-27-2007, 10:26 PM   #1
BrianDP1977
Junior Member
 
Join Date: Jul 2007
Posts: 23
Masking problem

I tried posting this problem once before but got no reply so I thought I would try explaining it a little better.

I use the following code within a movieclip (made of multiple other movieclips and named "mcMap") to drop circles (instances of a circle movieclip with the linkage name of "CircleSymbol") each time the player clicks in a designated area defined by a named movieclip "mcMap":
Code:
stop();
var i:Number = 0;
mcMap.onPress = function() {
    i++;
    _root.attachMovie("CircleSymbol", "mcCircle"+i, i, {_x:_root._xmouse, _y:_root._ymouse});
    _root.clipName = "mcCircle"+i;
    _root.xPos = _root._xmouse;
    _root.yPos = _root._ymouse;
    _root.scaleClip = true;
	_root.allowClip = true;
	_root["mcCircle" + i].setMask(mcMap);
};

mcMap.onRelease = function() {
    _root.scaleClip = false;
};

mcMap.onReleaseOutside = function() {
        _root.scaleClip = false;
};
The following code, placed on the first frame of the main timeline, allows the user to scale the size of the dropped circles if the user drags the mouse while holding down the mouse key:
Code:
stop();
_root.onEnterFrame = function() {
    if (_root.scaleClip == true) {
        xDist = _root._xmouse-_root.xPos;
        yDist = _root._ymouse-_root.yPos;
        if (_root[_root.clipName]._width + (_root.xDist + _root.yDist) > 10 && _root[_root.clipName]._height + (_root.xDist + _root.yDist) > 10) {
            _root[_root.clipName]._width += _root.xDist + _root.yDist;
            _root[_root.clipName]._height += _root.xDist + _root.yDist;
            _root.xPos = _root._xmouse;
            _root.yPos = _root._ymouse;
        }
    }
};
mcGotoMap.onRelease = function(){
	_root.mcMapAppear.gotoAndPlay("start");
};
The problem I am having is that although the circles are masked correctly when they are first dropped (i.e. they do not display outside of the "mcMap" area) once a subsequent circle is dropped the previous circle is no longer masked. I am using the following script in the first bit of code to define the mask for the dropped circles:
Code:
_root["mcCircle" + i].setMask(mcMap);
Attached is an example fla. Press the "Press to Start" button to see what is happening.
Attached Files
File Type: fla circle drop 002.fla (35.0 KB, 8 views)

Last edited by BrianDP1977; 07-27-2007 at 10:28 PM.
BrianDP1977 is offline   Reply With Quote
Reply

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:14 PM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.