I think there may be a problem when I call the treeGroup symbol. As3 isnt adding it to the display list? I got the code to load the external swf file from adobe. They did have more than one method so Im probably using the wrong one. The external file thats loading throws the error that you can see in the screen shot. The code is there too. This file runs fine with no errors and when I load the swf in the other file it has the error listed. I can also see and change the X and Y locations on the loaded movie but its not running. So its loaded but looks to me that there could be a problem with adding to the display list or maybe cause im using MovieClip(root) cause line 12 is where I first use this. I have to do it this way cause I need to use setChildIndex. If there is a different way then I could not call the symbol in from the libary and should be fine.
The main movie is the main menu for the game. The other file I want to load in is the first hole for this golf game I am making.
Here is the link to adobe and I used the first method they listed. https://helpx.adobe.com/flash/kb/load-external-swf-swf.html
I can provide all code for both swf files if you need more info.
error code is ArgumentError: Error #2005: Parameter 0 is of the incorrect type. Should be type BitmapData. at flash.display::BitmapData/hitTest() at Hole1_fla::Symbol2_1/treeDetect()[Hole1_fla.Symbol2_1::frame1:12]
this is how I am loading the swf.
var myLoader:Loader = new Loader(); // create a new instance of the Loader class
var url:URLRequest = new URLRequest("Hole1.swf"); // in this case both SWFs are in the same folder
myLoader.load(url);
And I think the code in the symbol is the issue.
var tree1:treeGroup = new treeGroup();
addChild(tree1);
setChildIndex(tree1,15);
var tree1Rect:Rectangle = tree1.getBounds(this);
var tree1ClipBmpData = new BitmapData(tree1Rect.width, tree1Rect.height, true, 0);
tree1ClipBmpData.draw(tree1);
addEventListener(Event.ENTER_FRAME,treeDetect);
function treeDetect(event:Event) {
// code for trees to detect if we hit some trees
if (tree1ClipBmpData.hitTest(new Point(tree1.x, tree1.y),255,MovieClip(root).ballClipBmpData,new Point(MovieClip(root).backhole1.golfball.x, MovieClip(root).backhole1.golfball.y),255)) { // this is line 12 poping the error in the symbol that is in the swf im loading in.
if (MovieClip(root).backhole1.golfball.scaleX == .1 && MovieClip(root).backhole1.golfball.scaleY == .1) {
setChildIndex(tree1,17);
if (MovieClip(root).backhole1.golfball.scaleX >= .3 && MovieClip(root).backhole1.golfball.scaleY >= .3) {
MovieClip(root).friction = .05;
}
}
if (MovieClip(root).backhole1.golfball.scaleX <= .3 && MovieClip(root).backhole1.golfball.scaleY <= .3) {
if (MovieClip(root).goingDown == 1) {
MovieClip(root).friction = .08;
setChildIndex(tree1,17);
MovieClip(root).backhole1.golfball.scaleX = .1;
MovieClip(root).backhole1.golfball.scaleY = .1;
MovieClip(root).goingDown = 0;
}
}
} else {
setChildIndex(tree1,15);
}
}
Where the first MovieClip(root) is in the hitTest is line 12 that pops the error message and is happening every frame.