LOADING
Loading
Hi , welcome back.
LogoutLOGOUT
 
  Lost password?  
Hi
 




 
 
Thread Tools Display Modes
  #1  
Old 02-23-2007, 04:29 PM
Chii's Avatar
Chii Chii is offline
Registered User
 
Join Date: Feb 2007
Posts: 8
Rep Power: 0
Chii is on a distinguished road
Machine HELP! flash- game & xml!!!

hi!
i'm making a flash game. but no matter how i try i can't get the *** movieclip to move!
is it possible to have two onEnterFrame functions running at the same time?

any ideas? Please help!!!


i also have a problem with a _mc.onPress function.
i have an empty movieclip in which i upload a picture from xml. now i want to be able to click the movieclip to perform a function.

the code is something like this:

pic = node.firstChild.frstChild.attributes.thepic;
_root.pic_mc.loadMovie("picfile/" + pic);

pic.onPress = function()
{
trace("inside pic- function");
_root.anotherEmpty_mc.loadMovie("pic2");
}


the uploading of the picture is no problem, that works just fine, the thing is that i never get into the pic.onPress- function.

please !
i don't know what to do!
  #2  
Old 02-25-2007, 12:13 AM
stringy stringy is offline
Registered User
 
Join Date: Dec 2006
Posts: 23
Rep Power: 0
stringy is on a distinguished road
You can only have one onEnterFrame per timeline

You will have to wait for the movie to load before assigning onPress but i think your target should be root.pic_mc
  #3  
Old 02-25-2007, 01:20 AM
toby toby is offline
Registered User
 
Join Date: Mar 2003
Posts: 13
Rep Power: 0
toby is on a distinguished road
You can only have one onEnterFrame per timeline, but every movieclip has its own timeline, so you can end up having as many onEnterFrame's as you have movieclips on any timeline, including the _root.

Code:
_root.clip1_mc.onEnterFrame = function(){
  trace("foo");
}
_root.clip2_mc.onEnterFrame = function(){
  trace("bar");
}
The reason that your onPress is not working, is because the loadMovie command is asynchronous, and loadMovie will overwrite any existing code on the loaded clip. That means Flash will not wait for the load to finish before it processes the next line of code in your example, and when the load finishes, it will overwrite the onPress that you have defined just after the call to loadMovie. In Flash, the events happen in this order

1. start loading the movie into the existing clip
2. define the onPress for the clip
3. finish loading the movie into the clip- and overwrite any existing code on the clip

So - what you need to do is define the onPress AFTER the load has completed. You can do this by using the an instance of the MovieClipLoader class to detect when the loadMovie has finished, and assign the onPress then.

Code:
mcloader = new MovieClipLoader();
mcloader.addListener(this);
mcloader.loadClip(_root.container_mc,"myContent.swf");

function onLoadInit(target_mc:MovieClip){
   if(target_mc == _root.container_mc){
      _root.container_mc.onPress = function(){
           trace("the onPress was defined after loading was complete");
       }
   }
   mcloader.removeListener(this);
}
For more on this, see the help section for MovieClipLoader class. Hope that helps.
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Flash Encrypt protects action script sintrix.com New Softwares 4 08-08-2007 05:07 AM
Flash Video Encoder Compare flashfever2nd New Softwares 1 05-20-2006 03:46 AM
Flash Game Sponsorship Games2Web Work/Job Opportunities 0 04-16-2006 01:42 AM
multiplayer flash game to sell win32 IT Bazaar Place 0 12-10-2005 03:19 PM
Flash MX and XML game razldazl Site Check 2 12-18-2004 01:24 AM




All times are GMT. The time now is 08:18 AM.