Odd Position Problem .:as2:.
- Archawn
-
Archawn
- Member since: Sep. 9, 2007
- Offline.
-
- Forum Stats
- Member
- Level 27
- Game Developer
First, here's a snippet of the code. It's supposed to spawn a movieclip at the center of the stage.
if(_root.numFalsches <= 0){
_root.attachMovie("AdoozyFalsch", "falsch"+_root.numFalsches, _root.numWindows);
_root["falsch"+_root.numFalsches]._x=800/2+(_root.numFalsches*3)
_root["falsch"+_root.numFalsches]._y=(600/2)+10+(_root.numFalsches*3)
_root.numFalsches++;
_root.numWindows++;
}
The problem is, it spawns the movieclip at the top left corner of the stage, no matter what number I enter for it's x or y position. I don't know why it's doing this. Help?
- Denvish
-
Denvish
- Member since: Apr. 25, 2003
- Offline.
-
- Send Private Message
- Browse All Posts (15,977)
- Block
-
- Forum Stats
- Member
- Level 46
- Blank Slate
That code works fine, places the MC at 400, 310. Your problem lies elsewhere.
numFalsches=0;
numWindows=1;
if(_root.numFalsches <= 0){
newf=_root.attachMovie("AdoozyFalsch", "falsch"+_root.numFalsches, _root.numWindows);
newf._x=800/2+(_root.numFalsches*3)
newf._y=(600/2)+10+(_root.numFalsches*3)
_root.numFalsches++;
_root.numWindows++;
trace(newf._x);
} - Archawn
-
Archawn
- Member since: Sep. 9, 2007
- Offline.
-
- Forum Stats
- Member
- Level 27
- Game Developer
http://spamtheweb.com/ul/upload/070209/3 2746_Movieclip_Placement_Problem.php
That's a video of the Problem. If the problem is elsewhere, here's the full code:
onClipEvent (load) {
var lastClick = 0;
var timer:Number = 0;
this.useHandCursor = false;
_root.useHandCursor = false;
}
onClipEvent (mouseUp) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
if (lastClick == 0) {
lastClick = 1;
timer = 10;
} else {
lastClick = 0;
if(_root.numFalsches <= 0){
_root.attachMovie("AdoozyFalsch", "falsch"+_root.numFalsches, _root.numWindows);
_root["falsch"+_root.numFalsches]._x=800/2+(_root.numFalsches*3)
_root["falsch"+_root.numFalsches]._y=(600/2)+10+(_root.numFalsches*3)
_root.numFalsches++;
_root.numWindows++;
}else if(_root.numFalsches>0 && _root.numFalsches<2){
_root.falsch0.duplicateMovieClip("falsch"+_root.numFalsches, _root.numWindows);
_root["falsch"+_root.numFalsches]._x=800/2+(_root.numFalsches*4)
_root["falsch"+_root.numFalsches]._y=(600/2)+10(_root.numFalsches*4)
_root.numFalsches++;
_root.numWindows++;
}
//trace(_root.numFalsches);
}
}
}
onClipEvent (enterFrame) {
if (timer == 0) {
lastClick = 0;
timer = 0;
} else {
timer -= 1;
}
this.onRollOver = function(){
this.gotoAndStop(2);
}
this.onRollOut = function(){
this.gotoAndStop(1);
}
this.onPress = function() {
this.gotoAndStop(2);
};
this.onRelease = function() {
this.gotoAndStop(2);
};
this.onReleaseOutside = function() {
this.gotoAndStop(1);
};
} - Denvish
-
Denvish
- Member since: Apr. 25, 2003
- Offline.
-
- Send Private Message
- Browse All Posts (15,977)
- Block
-
- Forum Stats
- Member
- Level 46
- Blank Slate
Video doesn't really show anything apart from the bottom right corner of the Flash stage.
In terms of the code, it appears to work fine.
I created a new fla, placed a button MC on stage and added that code to it, created a new MC with linkage "AdoozyFalsch", and added
numFalsches=0;
numWindows=1;
to the main timeline. On double-clicking the button, a new MC is attached at 400, 310.
Try doing it yourself in a new fla
- Archawn
-
Archawn
- Member since: Sep. 9, 2007
- Offline.
-
- Forum Stats
- Member
- Level 27
- Game Developer
That's so wierd. I have no idea what's wrong.
I have the same exact code (aside from instance names and variables) on the other icons. They work fine. The registration point is the same. What's wierd is it doesn't matter where I say the x and y positions should be, it always goes to the top left corner.
And that video was the .swf file. When the adoozy falsch icon is clicked, the splash screen is supposed to be in the middle of the screen, but the movieclip is placed in the top left corner.
- Archawn
-
Archawn
- Member since: Sep. 9, 2007
- Offline.
-
- Forum Stats
- Member
- Level 27
- Game Developer
At 2/7/09 09:24 AM, Archon68 wrote: And that video was the .swf file.
Well, it was a video of the .swf file. Not the actual thing. :-)
- Denvish
-
Denvish
- Member since: Apr. 25, 2003
- Offline.
-
- Send Private Message
- Browse All Posts (15,977)
- Block
-
- Forum Stats
- Member
- Level 46
- Blank Slate
At 2/7/09 09:29 AM, Archon68 wrote:At 2/7/09 09:24 AM, Archon68 wrote: And that video was the .swf file.Well, it was a video of the .swf file. Not the actual thing. :-)
Yeah I see what you mean, I thought that was your desktop. Only suggestion I can really offer is that you have a conflict somewhere with depths or other MCs elsewhere in the coding


