Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 02-27-2008, 06:30 PM   #1
anujsharma
Registered User
 
Join Date: Jun 2007
Posts: 22
Default ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.

Hi All
I am trying to make Video Gallery in AS 3.0. I have placed bunch of containers on my main stage. When user double clicks on any video thumbnail the main videos going to be played on the main stage. XML is loading external videos. The user can also drag the thumbnail and drop(multiple instances of thumbnails) on the main stage to play the main video.
The UILoader component is loading external swfs ( containing external FLVs)on drag and drop on the main stage. Also user would be able to drag and drop the already played videos.
Now my problem is that "When user tries to double clicks on the thumbnial and the video is going to be played on the main stage, when user tries to move that video he will get the run time error 'ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display:isplayObjectContainer/getChildIndex()
at MethodInfo-1092()'"

To track which video has been selected i used getChildIndex()method.That only happens when user tried to drag the video played by clicked thumbnail not by the dragged thumbnail.
Sorry for the long mail but I have to explain everything to make things clear.
Anybody knows where I am going wrong and how to fix this problem.
Any help will be highly appreciated.
Regards,
Anuj
anujsharma is offline   Reply With Quote
Old 02-27-2008, 07:45 PM   #2
ultraky
A flash Guy
 
Join Date: Mar 2007
Location: NYC
Posts: 79
Send a message via AIM to ultraky
Default

I get that message when my method is trying to access an object that isn't there- or think is not there.

How are you supplying the object to the method? How does it know which object to "getCHildIndex()" of?
ultraky is offline   Reply With Quote
Old 02-27-2008, 08:27 PM   #3
anujsharma
Registered User
 
Join Date: Jun 2007
Posts: 22
Default

Hi ultraky
Thanks for reply.
Here's my code for that. I made 'container' of type Sprite and inside the container I have my UILoader component. On Mouse_Down I am allowing myUILoader to start drag and on MOUSE_UP I am allowing it to stop drag and put the container whereever it was left mouse. I am checking if the existed object hits already existed object then it will be replaced.
Please let me know if it is clear and I will appreciate if you will fix this thing for me.
Thanks a lot.
Anuj
ActionScript Code:
// //Enabling Dragging & Dropping of Video Loader Anywhere          myUILoader.addEventListener(MouseEvent.MOUSE_DOWN,dragUILoader);         myUILoader.addEventListener(MouseEvent.MOUSE_UP,dropUILoader);         myUILoader.addEventListener(MouseEvent.CLICK, moveSelectedVideoOnFront);                 function dragUILoader(event:MouseEvent):void         {                      //Getting the Dragged Clip on top of all videos                var tt:Number=container.getChildIndex(myUILoader);                container.setChildIndex(container.getChildAt(tt), container.numChildren-1);                myUILoader.startDrag();             }               //Moving the clicked videos on top         function moveSelectedVideoOnFront(event:MouseEvent):void         {             //Getting the Index of video Clips on the stage             var tt:Number=container.getChildIndex(myUILoader);                container.setChildIndex(container.getChildAt(tt), container.numChildren-1);            }         function dropUILoader(event:MouseEvent):void         {                      if(myUILoader.y<UILoaderBoundary)                         {                    container.stopDrag();                 var trackX:Number=container.x;                 var trackY:Number=container.y;                            //Putting video on top of already existed videos                 var trackChild:Number=container.getChildIndex(myUILoader);                  var childContainer:DisplayObject= container.getChildAt(trackChild);                 for( var z:Number=0;z<=container.numChildren-1;z++)                 {                     var restChild:DisplayObject=container.getChildAt(z);                     if(childContainer!=restChild)                     {                                           if((childContainer.hitTestObject(restChild))==true)                             {                             container.removeChild(restChild);                         }                     }                                }                         }                   else             {                 container.removeChild(myUILoader);                    }             container.x=trackX;             container.y=trackY;                     }              }

Last edited by CyanBlue; 05-04-2010 at 07:10 PM. Reason: AS Tag applied...
anujsharma is offline   Reply With Quote
Old 02-27-2008, 09:49 PM   #4
anujsharma
Registered User
 
Join Date: Jun 2007
Posts: 22
Default

Never Mind problem has been fixed. I have to pass the correct container.
Thanks for ur patience & Help
Anuj
anujsharma is offline   Reply With Quote
Old 12-23-2009, 05:39 AM   #5
bagavathy.krish
Registered User
 
Join Date: Dec 2009
Posts: 1
Default #2025

Quote:
Originally Posted by anujsharma View Post
Never Mind problem has been fixed. I have to pass the correct container.
Thanks for ur patience & Help
Anuj
Hi anujsharma,
could please provide solution for your problem.I have come across the same error while trying to call one mxml application from another.
bagavathy.krish is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
DisplayObject must be a child of the caller texastoast ActionScript 3.0 18 08-25-2011 07:41 PM
child of the caller? p0c ActionScript 3.0 6 02-12-2008 03:16 PM
What happened to duplicateMovieClip() ? matbury ActionScript 3.0 5 12-01-2007 10:05 PM
The supplied DisplayObject must be a child of the caller? thomen Flex 2, 3 & 4 1 09-27-2007 11:54 AM
problem with child clips in main clip whiteboxer ActionScript 2.0 1 11-09-2006 05:45 PM


All times are GMT. The time now is 04:44 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.