Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Extensions and Plugins > Components

Reply
 
Thread Tools Rate Thread Display Modes
Old 03-26-2003, 08:39 AM   #1
pragathikanth
Registered User
 
Join Date: Mar 2002
Location: India
Posts: 12
Send a message via Yahoo to pragathikanth
Question mc.onData Vs onClipEvent(data) What is the difference??

Hi All,

I have a problem with onLoad/onData function.

Here’s what I am trying to do. Load a swf file in to an mc (myMC)
and I have this code on main timeline (_root ) to check if the swf is loaded into myMC.

//-------- code------------------
myMC.onData = function(){
trace("File loaded");
}


//I am loading the file on press of a button
// --------- loading image.swf into myMC---------

btn.onRelease = function(){
loadMovie("image.swf","_root.myMC")
}

/*
The above code should work right? some how it does not.
if I write the same thing on a ClipEvent it works.
*/
// onClipEvent check if the clip has recided data.

onClipEvent(data){
trace("File loaded");
}

The reason why I dont want to use onClipEvent is to avoid attaching any code to the MC’s.

Can some one please explain what is the difference between these two methods and how to check if the data is loaded into an MC if I have to write the code on the root.

Thanks for your time.

Last edited by pragathikanth; 03-26-2003 at 08:43 AM.
pragathikanth is offline   Reply With Quote
Old 03-26-2003, 09:20 AM   #2
senocular
six eyes
 
senocular's Avatar
 
Join Date: Jan 2003
Location: San Francisco, CA (USA)
Posts: 7,875
Send a message via ICQ to senocular Send a message via AIM to senocular Send a message via MSN to senocular Send a message via Yahoo to senocular
Default

this is more common with onLoad since that is what is normally used to handle the loading of movieclips being loaded in with loadMovie. onData is typical for loadVariables recognition.

What happens is, when a movieclip has a new swf loaded into it, all variables and functions originally set for that initial clip are cleared to make way for the new swf being loaded in. This includes any onLoad (or onData for that matter) function you may have defined. The reason they dont clear while ON the movieclip is because... well the code is physically attached to that object and remains even when the new swf is added.

There are several workarounds for this problem like this one
http://chattyfig.figleaf.com/ezmlm/e...gi?1:mss:49174
__________________
(6)
senocular is offline   Reply With Quote
Old 03-26-2003, 03:01 PM   #3
chewbacca nine
Registered User
 
Join Date: Mar 2003
Posts: 62
Default

sweet link, thanks.
chewbacca nine is offline   Reply With Quote
Old 03-26-2003, 04:01 PM   #4
pragathikanth
Registered User
 
Join Date: Mar 2002
Location: India
Posts: 12
Send a message via Yahoo to pragathikanth
Default

Hmmm, that explains, I always thought when onLoad is used it would function like the onClipEvent, but then I should have thought abt it harder. If it did, why would they have two ways of going about it.
Anyways I am clear now, I had been breaking my head over this for a day now. Thanks a lot for your help "senocular". Will sleep peacefully and think about the other problem, Just a thought would you have any idea about how to go about capturing a double click on a listBox item?? Well it would be great if you could help me with this too

Thanks a lot again for your help and your time.
pragathikanth is offline   Reply With Quote
Old 03-26-2003, 07:06 PM   #5
mmaster
Registered User
 
Join Date: Jul 2002
Location: Montreal, Canada
Posts: 7
Default

I tried the code in that link as is, and it didn't work for me. I never saw the trace output in my Flash MX. Has anybody got it working?
mmaster is offline   Reply With Quote
Old 03-27-2003, 08:49 AM   #6
pragathikanth
Registered User
 
Join Date: Mar 2002
Location: India
Posts: 12
Send a message via Yahoo to pragathikanth
Default I tried the code in that link as is, and it didn't work for me. I never saw the trace

Yes, I did and it works fine It shows the trace in the output window.

You need to have the test.swf file in the same folder. It should work, it did for me.
pragathikanth is offline   Reply With Quote
Old 06-02-2006, 07:32 AM   #7
December
Registered User
 
Join Date: Jun 2006
Posts: 1
Question

Sorry for bringing up this thread again, but it shows exactly whats my current problem.

And senocular's link is a dead link now There should be more workarounds for this prob. Can anyone please post some other link to a workaround relating to this onData prob?

Thx a lot

Greetz, December
December is offline   Reply With Quote
Old 06-05-2006, 06:29 AM   #8
Glen Charles Rowell
Senior Member
 
Glen Charles Rowell's Avatar
 
Join Date: Nov 2005
Posts: 623
Default

I know this is old but I wanna see that link too
Glen Charles Rowell 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 Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:43 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.