3 Replies Latest reply on May 10, 2007 1:42 PM by nemesis_256

    Socket connections and "child of the caller" error

    nemesis_256 Level 1
      So I have 2 problems. One is with an XMLSocket connections. When I have it running in flash it obviously works, but when it's running throught the swf or on a website I get a security error. Is there a way I can make it work either way? Here are the two errors.

      When running the swf
      SecurityError: Error #2010: Local-with-filesystem SWF files are not permitted to use sockets.

      and when running on a website
      Error #2044: Unhandled SecurityErrorEvent:. text=Error #2048: Security sandbox violation: http://wayfaererstudios.com/Breakout.swf cannot load data from localhost:31337.


      Now for this other problem. Here's the error
      ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
      at flash.display::DisplayObjectContainer/removeChild()
      at Breakout/::blockCollision()
      at Breakout/::onEnterFrame()

      Just to make it more obvious this is for a breakout game. I get that error when the ball gets close to or hits some of the blocks (not all). It seems to come up when it's possibly hitting multiple blocks. What's kinda weird is that the game still works perfectly fine. It's just annoying to see this error. What I'm mostly doing in that function is checking for the collision detection with some if statements. Here's the code that actually does the work when the statements are true:

      removeChild(block);
      blocksHit++;
      directionY *= -1;

      So the problem is obviously the removeChild. The block is just the variable that's stored in an array called blocks and I'm using a for each to go through each of the blocks. How can I get rid of this error?