Welcome to Dream.In.Code
Getting Help is Easy!

Join 136,451 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,006 people online right now. Registration is fast and FREE... Join Now!




Attach movie into main timeline.

 
Reply to this topicStart new topic

Attach movie into main timeline.

cadeownz
3 Aug, 2008 - 10:09 PM
Post #1

New D.I.C Head
*

Joined: 11 Jul, 2008
Posts: 31

hey,
in my rpg i got a button that when u click it u get an archer. the only problem is when u click it u get one.. BUT the archer is a button and if u click the archer it makes another one crazy.gif , i need it to attach to the main timeline so its just a normal movieclip. AND if possible give it some actions iv set. so if i attach it i can walk arround or something. <--- You dont have to ansa that.
Code...
CODE
on (release) {
    attachMovie("hello", "hello", 1);}

please help, it will be much appreciated..
thanks in advance..
ph34r.gif ph34r.gif ph34r.gif ph34r.gif ph34r.gif ph34r.gif ph34r.gif ph34r.gif smile.gif

This post has been edited by cadeownz: 3 Aug, 2008 - 10:11 PM
User is offlineProfile CardPM
+Quote Post

BetaWar
RE: Attach Movie Into Main Timeline.
3 Aug, 2008 - 11:44 PM
Post #2

#include <soul.h>
Group Icon

Joined: 7 Sep, 2006
Posts: 2,022



Thanked: 81 times
Dream Kudos: 1175
My Contributions
try this:

(place in _root frame 1 for ease of use):
CODE

var attached_archers:Number = 0;


Use this to attach the archers:
CODE

on(release){
  _root.attachMovie("hello", "hello_"+_root.attahced_archers, attached_archers);
  attached_archers++;
}


Then if you want them to do various things you can give them functions when creating them like so:

CODE

on(release){
  var mc:MovieClip = _root.attachMovie("hello", "hello_"+_root.attahced_archers, attached_archers);
  attached_archers++;
  mc.onEnterFrame = function(){
    //Do things for the onenterframe function of the new movieclip
  }
}


Hope that helps.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 03:09PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month