| Ultrashock Forums
• how to correct this; TypeError: Error #2007: Parameter sound must be non-null. |
|||
![]() |
||||
| Search this Thread | Thread Tools | Display Modes |
|
|
|||||||||||||||||||||||||
![]() |
Ultrashock Member Comments:
|
2008-01-17
#2 |
||
|
|
2008-01-17
#3 |
||
|
hi Rackdoll. I'm not sure what you mean... I've tried this: Code:
var mysound:Sound = new Sound; mysound(new URLRequest(theMusic)); but that doesn't help. what did you mean? thanks felisan |
|
|
2008-01-17
#4 |
||
|
please, can anyone help?
|
|
4 Creative Assets
|
2008-01-17
#5 |
||
|
Hi!, I made a few modifications to your code, but everything is working now ![]() Here is the new code, I will explain some of my changes below: ActionScript Code:
First thing I did was finish the constructor for ByteArray. Byte arrays need to be instantiated like a standard array, like this: var byteArray:ByteArray = new ByteArray(); (You had everything except the = new ByteArray() part). I added your display sprite's declaration with your other private variables so it would only need to be referenced once throughout the visualizations. I also added this.addChild(myVisualizer); to your init, so that the content being drawn within that sprite would be visible to the user. I moved your Sound constructor with your other private variables, again, to make it a global reference. I completed your clear function inside your doTheGraphics function. You just didn't have parenthesis after clear, as in clear(); I removed the new constructor from your myVisualizer sprite since in this case, reinstantiating myVisualizer would cause your system to get very bogged down with that many sprites being referenced in the application. I hope this helps, let me know if anything else arises. |
|
|
2008-01-17
#6 |
||
|
ok. - you corrected ByteArray and clear. - you added the displaySprite to the displaylist, making it visible. - then you listed Sound and displaySprite among the other private variables for quicker future reference. - and finally you removed the instantiation of the displaySprite for better flow. correct? thanks. you have helped me very much owe you one!felisan |
|
4 Creative Assets
|
2008-01-17
#7 |
||
|
Yep, I believe that was it Have fun, visualizations are a great thing to learn with.
|
|
|
2010-02-08
#8 |
||
I need help. I have this action script here...and I keep getting that same errorTypeError: Error #2007: Parameter child must be non-null. at flash.display: isplayObjectContainer/removeChild()at DotDrawFull_startTryone_fla::MainTimeline/clearCanvas() This is my action script. I believe the only thing wrong with it is at the bottom which states: clear_btn.addEventListener(MouseEvent.CLICK, clearCanvas); function clearCanvas (evt:MouseEvent): void { var myDot_mc: MovieClip; var numbDots:Number=dotArray.length; for (var i:Number= 0; i<numbDots; i++) myDot_mc=dotArray.pop(); canvas.removeChild(myDot_mc); myDot_mc=null; } When I have this action script I should be able to press this button with a instance name clear_btn and the dots on the page should be "erased". I don't know what is going on. Here is the full action script var currentColor:String= "green"; var dotArray:Array= new Array; setGreen_btn.addEventListener (MouseEvent.CLICK,setGreenPencil); setRed_btn.addEventListener (MouseEvent.CLICK, setRedPencil); setBlue_btn.addEventListener (MouseEvent.CLICK, setBluePencil); function setGreenPencil(evt:MouseEvent): void { currentColor= "green"; } function setRedPencil (evt:MouseEvent): void { currentColor="red"; } function setBluePencil(evt:MouseEvent): void { currentColor="blue"; } canvas.addEventListener (MouseEvent.MOUSE_DOWN, startDraw); function startDraw (evt:MouseEvent): void{ canvas.addEventListener(MouseEvent.MOUSE_MOVE, drawShape); canvas.addEventListener(MouseEvent.MOUSE_UP, stopDraw); } function drawShape (evt:MouseEvent): void{ var myDot_mc: MovieClip; if (currentColor == "red") { myDot_mc=new RedDot (); } else if (currentColor == "blue") { myDot_mc=new BlueDot(); } else { myDot_mc=new GreenDot (); } myDot_mc.x=mouseX-canvas.x; myDot_mc.y=mouseY-canvas.y; dotArray.push (myDot_mc); canvas.addChild(myDot_mc); } function stopDraw (evt:MouseEvent):void { canvas.removeEventListener(MouseEvent.MOUSE_MOVE,drawShape); canvas.removeEventListener(MouseEvent.MOUSE_UP, stopDraw); } clear_btn.addEventListener(MouseEvent.CLICK, clearCanvas); function clearCanvas (evt:MouseEvent): void { var myDot_mc: MovieClip; var numbDots:Number=dotArray.length; for (var i:Number= 0; i<numbDots; i++) myDot_mc=dotArray.pop(); canvas.removeChild(myDot_mc); myDot_mc=null; } |
|
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|


7 comments
| 4992 views



4 Creative Assets
owe you one!
I need help. I have this action script here...and I keep getting that same error
isplayObjectContainer/removeChild()
Linear Mode
Just make a soundObject and do not pass a URLRequest in it...
Then just play or load the URLRequest..