# MovieClip, PaperVision, Depth Problem?

**URL:** <https://forum.kirupa.com/t/movieclip-papervision-depth-problem/271824>\
**Category:** flash\
**Created:** [September 29, 2008, 5:50am UTC](https://forum.kirupa.com/t/movieclip-papervision-depth-problem/271824 "2008-09-29T05:50:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sepu](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@sepu](https://forum.kirupa.com/u/sepu)\
**Post date:** [September 29, 2008, 5:50am UTC](https://forum.kirupa.com/t/movieclip-papervision-depth-problem/271824/1 "2008-09-29T05:50:40Z")

</div>

Hello there …

I’m working on this piece … I haven’t done the transition to AS3 yet and I decide this will be a good project to start doing it. Anyway so I got this papervision plane that actually is a movieclip in the stage with blend mode of “erase”.  
And I want to interact with this this works sometimes if I created buttons inside the movieclip but when I want to add MovieClips or sprites or both added them dynamically (like the circle) I can’t interact I mean you can but is kind of weird, you gotta really move your mouse around and try to hit the corners or weird angles to make it work …  
How can you add stuff to the plane and interact with them ? there is a better way to do this ?

Also as you can see Im having trouble to keep the btns under my papervision … I’ve tried different thing none of them work so far any ideas ?

here is the FLA and the code … Thanks for any help.

FLA: [http://www.hsdesign.org/Wip/test/ex6.fla.zip](http://www.hsdesign.org/Wip/test/ex6.fla.zip)  
Example : [http://www.hsdesign.org/Wip/test/ex6.swf](http://www.hsdesign.org/Wip/test/ex6.swf)

```
 ActionScript Code:
 [LEFT][COLOR=#0000ff]import[/COLOR] gs.*;

```

[COLOR=#0000ff]import[/COLOR] gs.[COLOR=#000080]easing[/COLOR]._;  
[COLOR=#0000ff]import[/COLOR] org.[COLOR=#000080]papervision3d[/COLOR].[COLOR=#000080]scenes[/COLOR]._;  
[COLOR=#0000ff]import[/COLOR] org.[COLOR=#000080]papervision3d[/COLOR].[COLOR=#000080]cameras[/COLOR]._;  
[COLOR=#0000ff]import[/COLOR] org.[COLOR=#000080]papervision3d[/COLOR].[COLOR=#000080]objects[/COLOR]._;  
[COLOR=#0000ff]import[/COLOR] org.[COLOR=#000080]papervision3d[/COLOR].[COLOR=#000080]objects[/COLOR].[COLOR=#000080]special[/COLOR]._;  
[COLOR=#0000ff]import[/COLOR] org.[COLOR=#000080]papervision3d[/COLOR].[COLOR=#000080]objects[/COLOR].[COLOR=#000080]primitives[/COLOR]._;  
[COLOR=#0000ff]import[/COLOR] org.[COLOR=#000080]papervision3d[/COLOR].[COLOR=#000080]materials[/COLOR]._;  
[COLOR=#0000ff]import[/COLOR] org.[COLOR=#000080]papervision3d[/COLOR].[COLOR=#000080]materials[/COLOR].[COLOR=#000080]special[/COLOR]._;  
[COLOR=#0000ff]import[/COLOR] org.[COLOR=#000080]papervision3d[/COLOR].[COLOR=#000080]materials[/COLOR].[COLOR=#000080]shaders[/COLOR]._;  
[COLOR=#0000ff]import[/COLOR] org.[COLOR=#000080]papervision3d[/COLOR].[COLOR=#000080]materials[/COLOR].[COLOR=#000080]utils[/COLOR]._;  
[COLOR=#0000ff]import[/COLOR] org.[COLOR=#000080]papervision3d[/COLOR].[COLOR=#000080]lights[/COLOR]._;  
[COLOR=#0000ff]import[/COLOR] org.[COLOR=#000080]papervision3d[/COLOR].[COLOR=#000080]render[/COLOR]._;  
[COLOR=#0000ff]import[/COLOR] org.[COLOR=#000080]papervision3d[/COLOR].[COLOR=#000080]view[/COLOR]._;  
[COLOR=#0000ff]import[/COLOR] org.[COLOR=#000080]papervision3d[/COLOR].[COLOR=#000080]events[/COLOR]._;  
[COLOR=#0000ff]import[/COLOR] org.[COLOR=#000080]papervision3d[/COLOR].[COLOR=#000080]core[/COLOR].[COLOR=#000080]utils[/COLOR].\*;  
[COLOR=#0000ff]import[/COLOR] org.[COLOR=#000080]papervision3d[/COLOR].[COLOR=#000080]core[/COLOR].[COLOR=#000080]utils[/COLOR].[COLOR=#000080]virtualmouse[/COLOR].[COLOR=#000080]VirtualMouse[/COLOR];  
[COLOR=#0000ff]import[/COLOR] flash.[COLOR=#000080]net[/COLOR].[COLOR=#000080]URLRequest[/COLOR];

[COLOR=#000000] **var** [/COLOR] movie:[COLOR=#0000ff]MovieClip[/COLOR];  
[COLOR=#000000] **var** [/COLOR] nSpacing:[COLOR=#0000ff]Number[/COLOR] = -[COLOR=#000080]20[/COLOR];  
[COLOR=#000000] **var** [/COLOR] nBtns:[COLOR=#0000ff]Number[/COLOR] = [COLOR=#000080]4[/COLOR];  
[COLOR=#000000] **var** [/COLOR] filt:GlowFilter = [COLOR=#000000] **new** [/COLOR] GlowFilter;  
[COLOR=#000000] **var** [/COLOR] filtPanel:GlowFilter = [COLOR=#000000] **new** [/COLOR] GlowFilter;  
[COLOR=#000000] **var** [/COLOR] aUrl:[COLOR=#0000ff]Array[/COLOR] = [COLOR=#000000] **new** [/COLOR] [COLOR=#0000ff]Array[/COLOR]COLOR=#000000[/COLOR];

filt.[COLOR=#0000ff]color[/COLOR] = 0x000000;  
filt.[COLOR=#000080]blurX[/COLOR] = [COLOR=#000080]15[/COLOR];  
filt.[COLOR=#000080]blurY[/COLOR] = [COLOR=#000080]15[/COLOR];  
filt.[COLOR=#0000ff]quality[/COLOR] = [COLOR=#000080]2[/COLOR];  
filt.[COLOR=#000080]strength[/COLOR] = [COLOR=#000080]1[/COLOR];

filtPanel.[COLOR=#0000ff]color[/COLOR] = 0x000000;  
filtPanel.[COLOR=#000080]blurX[/COLOR] = [COLOR=#000080]20[/COLOR];  
filtPanel.[COLOR=#000080]blurY[/COLOR] = [COLOR=#000080]20[/COLOR];  
filtPanel.[COLOR=#0000ff]quality[/COLOR] = [COLOR=#000080]2[/COLOR];  
filtPanel.[COLOR=#000080]strength[/COLOR] = [COLOR=#000080]1[/COLOR];

[COLOR=#0000ff]for[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#000000] **var** [/COLOR] i:[COLOR=#0000ff]int[/COLOR] = [COLOR=#000080]0[/COLOR]; i \< nBtns; i++[COLOR=#000000])[/COLOR][COLOR=#000000]{[/COLOR]  
movie = [COLOR=#000000] **new** [/COLOR] mcCOLOR=#000000[/COLOR];  
movie.[COLOR=#000080]x[/COLOR] = [COLOR=#000080]420[/COLOR] + i \* [COLOR=#000000]([/COLOR]movie.[COLOR=#0000ff]width[/COLOR] + nSpacing[COLOR=#000000])[/COLOR];  
movie.[COLOR=#000080]y[/COLOR] = [COLOR=#000080]365[/COLOR];  
movie.[COLOR=#0000ff]name[/COLOR] = [COLOR=#ff0000]“btn”[/COLOR] + i;  
movie.[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000080]ROLL\_OVER[/COLOR], ROLLOVER, [COLOR=#000000] **false** [/COLOR], [COLOR=#000080]0[/COLOR], [COLOR=#000000] **true** [/COLOR][COLOR=#000000])[/COLOR];  
movie.[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000080]ROLL\_OUT[/COLOR], ROLLOUT, [COLOR=#000000] **false** [/COLOR], [COLOR=#000080]0[/COLOR], [COLOR=#000000] **true** [/COLOR][COLOR=#000000])[/COLOR];  
movie.[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000080]CLICK[/COLOR], CLICKED, [COLOR=#000000] **false** [/COLOR], [COLOR=#000080]0[/COLOR], [COLOR=#000000] **true** [/COLOR][COLOR=#000000])[/COLOR];  
movie.[COLOR=#000080]buttonMode[/COLOR] = [COLOR=#000000] **true** [/COLOR];  
movie.[COLOR=#000080]filters[/COLOR] = [COLOR=#000000][[/COLOR]filt[COLOR=#000000]][/COLOR];  
addChildCOLOR=#000000[/COLOR];  
[COLOR=#000000]}[/COLOR]

[COLOR=#000000] **var** [/COLOR] viewPort:Viewport3D = [COLOR=#000000] **new** [/COLOR] Viewport3D[COLOR=#000000]([/COLOR][COLOR=#000080]0[/COLOR], [COLOR=#000080]0[/COLOR], [COLOR=#000000] **true** [/COLOR], [COLOR=#000000] **true** [/COLOR][COLOR=#000000])[/COLOR];  
addChildCOLOR=#000000[/COLOR];  
viewPort.[COLOR=#000080]buttonMode[/COLOR] = [COLOR=#000000] **true** [/COLOR];

[COLOR=#000000] **var** [/COLOR] render:BasicRenderEngine = [COLOR=#000000] **new** [/COLOR] BasicRenderEngineCOLOR=#000000[/COLOR];  
[COLOR=#000000] **var** [/COLOR] scene:Scene3D = [COLOR=#000000] **new** [/COLOR] Scene3DCOLOR=#000000[/COLOR];  
[COLOR=#000000] **var** [/COLOR] [COLOR=#0000ff]camera[/COLOR]:Camera3D = [COLOR=#000000] **new** [/COLOR] Camera3DCOLOR=#000000[/COLOR];  
[COLOR=#0000ff]camera[/COLOR].[COLOR=#000080]zoom[/COLOR] = [COLOR=#000080]11[/COLOR];  
[COLOR=#0000ff]camera[/COLOR].[COLOR=#000080]focus[/COLOR] = [COLOR=#000080]100[/COLOR];  
[COLOR=#0000ff]camera[/COLOR].[COLOR=#000080]x[/COLOR] = [COLOR=#000080]70[/COLOR];

[COLOR=#000000] **var** [/COLOR] mm1:MovieMaterial = [COLOR=#000000] **new** [/COLOR] MovieMaterial[COLOR=#000000]([/COLOR]panel\_mc, [COLOR=#000000] **true** [/COLOR][COLOR=#000000])[/COLOR];  
mm1.[COLOR=#000080]interactive[/COLOR] = [COLOR=#000000] **true** [/COLOR];  
mm1.[COLOR=#000080]animated[/COLOR] = [COLOR=#000000] **true** [/COLOR];  
mm1.[COLOR=#000080]smooth[/COLOR] = [COLOR=#000000] **true** [/COLOR];  
mm1.[COLOR=#000080]invisible[/COLOR] = [COLOR=#000000] **true** [/COLOR];

[COLOR=#000000] **var** [/COLOR] plane:Plane = [COLOR=#000000] **new** [/COLOR] Plane[COLOR=#000000]([/COLOR]mm1, [COLOR=#000080]770[/COLOR], [COLOR=#000080]590[/COLOR], [COLOR=#000080]10[/COLOR], [COLOR=#000080]10[/COLOR][COLOR=#000000])[/COLOR];  
scene.[COLOR=#000080]addChild[/COLOR]COLOR=#000000[/COLOR];

TweenLite.[COLOR=#000080]to[/COLOR][COLOR=#000000]([/COLOR]panel\_mc, [COLOR=#000080]0[/COLOR], [COLOR=#000000]{[/COLOR]alpha:[COLOR=#000080]0[/COLOR][COLOR=#000000]}[/COLOR][COLOR=#000000])[/COLOR];

[COLOR=#000000] **function** [/COLOR] ROLLOVERCOLOR=#000000[/COLOR]:[COLOR=#0000ff]void[/COLOR] [COLOR=#000000]{[/COLOR]  
[COLOR=#808080]_//setChildIndex(MovieClip(e.target), numChildren-1); // problem with Depths!!!_[/COLOR]

TweenLite.[COLOR=#000080]to[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000ff]e[/COLOR].[COLOR=#0000ff]target[/COLOR], .[COLOR=#000080]5[/COLOR], [COLOR=#000000]{[/COLOR]frame:[COLOR=#000080]50[/COLOR], ease:Expo.[COLOR=#000080]easeOut[/COLOR][COLOR=#000000]}[/COLOR][COLOR=#000000])[/COLOR];

[COLOR=#000000]}[/COLOR]

[COLOR=#000000] **function** [/COLOR] ROLLOUTCOLOR=#000000[/COLOR]:[COLOR=#0000ff]void[/COLOR] [COLOR=#000000]{[/COLOR]  
TweenLite.[COLOR=#000080]to[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000ff]e[/COLOR].[COLOR=#0000ff]target[/COLOR], [COLOR=#000080]1[/COLOR], [COLOR=#000000]{[/COLOR]frame:[COLOR=#000080]1[/COLOR], tint:0x000000, ease:Expo.[COLOR=#000080]easeOut[/COLOR][COLOR=#000000]}[/COLOR][COLOR=#000000])[/COLOR];  
[COLOR=#000000]}[/COLOR]

[COLOR=#000000] **function** [/COLOR] CLICKEDCOLOR=#000000[/COLOR]:[COLOR=#0000ff]void[/COLOR] [COLOR=#000000]{[/COLOR]  
[COLOR=#0000ff]trace[/COLOR]COLOR=#000000[/COLOR];  
mm1.[COLOR=#000080]invisible[/COLOR] = [COLOR=#000000] **false** [/COLOR];  
TweenLite.[COLOR=#000080]to[/COLOR][COLOR=#000000]([/COLOR]panel\_mc, [COLOR=#000080]1[/COLOR], [COLOR=#000000]{[/COLOR]alpha:[COLOR=#000080]1[/COLOR], x:[COLOR=#000080]52[/COLOR], ease:Back.[COLOR=#000080]easeIn[/COLOR][COLOR=#000000]}[/COLOR] [COLOR=#000000])[/COLOR];  
panel\_mc.[COLOR=#000080]filters[/COLOR] = [COLOR=#000000][[/COLOR]filtPanel[COLOR=#000000]][/COLOR];  
[COLOR=#000000]}[/COLOR]

[COLOR=#000000] **var** [/COLOR] spBtn:[COLOR=#0000ff]MovieClip[/COLOR] = [COLOR=#000000] **new** [/COLOR] [COLOR=#0000ff]MovieClip[/COLOR]COLOR=#000000[/COLOR];  
spBtn.[COLOR=#000080]x[/COLOR] = [COLOR=#000080]500[/COLOR];  
spBtn.[COLOR=#000080]y[/COLOR] = [COLOR=#000080]400[/COLOR];  
spBtn.[COLOR=#000080]graphics[/COLOR].[COLOR=#0000ff]beginFill[/COLOR]COLOR=#000000[/COLOR];  
spBtn.[COLOR=#000080]graphics[/COLOR].[COLOR=#000080]drawCircle[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000080]40[/COLOR], [COLOR=#000080]40[/COLOR], [COLOR=#000080]40[/COLOR][COLOR=#000000])[/COLOR];  
spBtn.[COLOR=#000080]buttonMode[/COLOR] = [COLOR=#000000] **true** [/COLOR];

panel\_mc.[COLOR=#000080]addChild[/COLOR]COLOR=#000000[/COLOR];

spBtn.[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000080]ROLL\_OVER[/COLOR], onOver, [COLOR=#000000] **false** [/COLOR], [COLOR=#000080]0[/COLOR], [COLOR=#000000] **true** [/COLOR][COLOR=#000000])[/COLOR];  
spBtn.[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000080]ROLL\_OUT[/COLOR], onOut, [COLOR=#000000] **false** [/COLOR], [COLOR=#000080]0[/COLOR], [COLOR=#000000] **true** [/COLOR][COLOR=#000000])[/COLOR];

[COLOR=#000000] **function** [/COLOR] onOverCOLOR=#000000[/COLOR]:[COLOR=#0000ff]void[/COLOR] [COLOR=#000000]{[/COLOR]  
[COLOR=#0000ff]trace[/COLOR]COLOR=#000000[/COLOR];  
TweenLite.[COLOR=#000080]to[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000ff]e[/COLOR].[COLOR=#0000ff]target[/COLOR], .[COLOR=#000080]5[/COLOR],[COLOR=#000000]{[/COLOR]scaleX:[COLOR=#000080]1[/COLOR].[COLOR=#000080]2[/COLOR], scaleY:[COLOR=#000080]1[/COLOR].[COLOR=#000080]2[/COLOR], ease:Expo.[COLOR=#000080]easeIn[/COLOR][COLOR=#000000]}[/COLOR][COLOR=#000000])[/COLOR];  
[COLOR=#000000]}[/COLOR]

[COLOR=#000000] **function** [/COLOR] onOutCOLOR=#000000[/COLOR]:[COLOR=#0000ff]void[/COLOR] [COLOR=#000000]{[/COLOR]  
[COLOR=#0000ff]trace[/COLOR]COLOR=#000000[/COLOR];  
TweenLite.[COLOR=#000080]to[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000ff]e[/COLOR].[COLOR=#0000ff]target[/COLOR], [COLOR=#000080]1[/COLOR],[COLOR=#000000]{[/COLOR]scaleX:[COLOR=#000080]1[/COLOR], scaleY:[COLOR=#000080]1[/COLOR], ease:Expo.[COLOR=#000080]easeOut[/COLOR][COLOR=#000000]}[/COLOR][COLOR=#000000])[/COLOR];  
[COLOR=#000000]}[/COLOR]

panel\_mc.[COLOR=#000080]home\_btn[/COLOR].[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000080]CLICK[/COLOR], onClick, [COLOR=#000000] **false** [/COLOR], [COLOR=#000080]0[/COLOR], [COLOR=#000000] **true** [/COLOR][COLOR=#000000])[/COLOR];

[COLOR=#000000] **function** [/COLOR] onClickCOLOR=#000000[/COLOR]:[COLOR=#0000ff]void[/COLOR] [COLOR=#000000]{[/COLOR]  
navigateToURL[COLOR=#000000]([/COLOR][COLOR=#000000] **new** [/COLOR] URLRequestCOLOR=#000000[/COLOR],[COLOR=#ff0000]"\_blank"[/COLOR][COLOR=#000000])[/COLOR];  
[COLOR=#000000]}[/COLOR]

panel\_mc.[COLOR=#000080]close\_btn[/COLOR].[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000080]CLICK[/COLOR], [COLOR=#0000ff]onclose[/COLOR], [COLOR=#000000] **false** [/COLOR], [COLOR=#000080]0[/COLOR], [COLOR=#000000] **true** [/COLOR][COLOR=#000000])[/COLOR];

[COLOR=#000000] **function** [/COLOR] [COLOR=#0000ff]onclose[/COLOR]COLOR=#000000[/COLOR]:[COLOR=#0000ff]void[/COLOR] [COLOR=#000000]{[/COLOR]  
TweenLite.[COLOR=#000080]to[/COLOR][COLOR=#000000]([/COLOR]panel\_mc, [COLOR=#000080]1[/COLOR], [COLOR=#000000]{[/COLOR]alpha:[COLOR=#000080]0[/COLOR], x:-[COLOR=#000080]1000[/COLOR], ease:Back.[COLOR=#000080]easeOut[/COLOR], onComplete:callInvisible[COLOR=#000000]}[/COLOR] [COLOR=#000000])[/COLOR];  
[COLOR=#000000]}[/COLOR]

[COLOR=#000000] **function** [/COLOR] callInvisibleCOLOR=#000000[/COLOR]:[COLOR=#0000ff]void[/COLOR] [COLOR=#000000]{[/COLOR]  
mm1.[COLOR=#000080]invisible[/COLOR] = [COLOR=#000000] **true** [/COLOR];  
[COLOR=#000000]}[/COLOR]

addEventListener[COLOR=#000000]([/COLOR]Event.[COLOR=#000080]ENTER\_FRAME[/COLOR], loop[COLOR=#000000])[/COLOR];

[COLOR=#000000] **function** [/COLOR] loopCOLOR=#000000[/COLOR]:[COLOR=#0000ff]void[/COLOR] [COLOR=#000000]{[/COLOR]  
[COLOR=#000000] **var** [/COLOR] disX:[COLOR=#0000ff]Number[/COLOR] = mouseX - [COLOR=#0000ff]stage[/COLOR].[COLOR=#000080]stageWidth[/COLOR] \* [COLOR=#000080]0[/COLOR].[COLOR=#000080]5[/COLOR];  
[COLOR=#000000] **var** [/COLOR] disY:[COLOR=#0000ff]Number[/COLOR] = mouseY - [COLOR=#0000ff]stage[/COLOR].[COLOR=#000080]stageHeight[/COLOR] \* [COLOR=#000080]0[/COLOR].[COLOR=#000080]5[/COLOR];

plane.[COLOR=#000080]rotationY[/COLOR] = disX \* [COLOR=#000080]0[/COLOR].[COLOR=#000080]05[/COLOR];  
plane.[COLOR=#000080]rotationX[/COLOR] = disY \* [COLOR=#000080]0[/COLOR].[COLOR=#000080]05[/COLOR];

render.[COLOR=#000080]renderScene[/COLOR][COLOR=#000000]([/COLOR]scene, [COLOR=#0000ff]camera[/COLOR], viewPort[COLOR=#000000])[/COLOR];  
[COLOR=#000000]}[/COLOR]  
[/LEFT]
