A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: if i name a movie clip with a number then can i do this?

  1. #1
    Senior Member
    Join Date
    Aug 2005
    Posts
    225

    if i name a movie clip with a number then can i do this?

    the code is in the movie clip

    Code:
    	_root.hitPlace.gotoAndPlay(_root[this]);
    	_root.backGround.gotoAndPlay(_root[this]);
    this doesnt actually work but how can i get something like it to work
    Last edited by helpmeplz; 12-21-2005 at 09:09 PM.

  2. #2
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    Confusing question. Please explain better.

  3. #3
    Hey Timmy!!! walsher's Avatar
    Join Date
    Jan 2005
    Location
    Latrobe, PA
    Posts
    1,899
    Yeah, need more info to help yea out.

  4. #4
    Senior Member
    Join Date
    Jul 2005
    Posts
    692
    I think he means that if he has, lets say ten MCs named
    hitPlace1
    hitPlace2
    hitPlace3
    hitPlace4
    hitPlace5
    hitPlace6
    hitPlace7
    hitPlace8
    hitPlace9
    hitPlace10

    that he could check them all with one line of code. coincidentally I, just this moring, realised i need this feature.

  5. #5
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    In that case I suggest saving variable inside each of the mcs which will have the same value as the number in the end of its name. Basically it is also possible to strip the name so only number remains, but it requires using substring and is not easiest way.

  6. #6
    for (a=1; a<10; a++){
    _root.myMovie["hitPlace"+a].gotoAndStop(2);
    }

    not sure if thats what you mean but using ["name"+var containing num for each MC] is very usful in this regard.

    Ely

  7. #7
    President PhobiK's Avatar
    Join Date
    Jan 2005
    Location
    Guatemala
    Posts
    918
    I think what he means is that if you have a mc with a name consisting only of a number, is it possible to tell the movie (or a MC) to gotoAndPlay(myInstanceName).
    Yeah, it can be done this way:
    _root.hitPlace.gotoAndPlay(this._name);
    _root.backGround.gotoAndPlay(this._name);

    Or to be more precise _root.hitPlace.gotoAndPlay(Number(this._name));
    This is MC. His _parents sent him to stop() by the super market to buy some _root beer if he wanted to gotoAndPlay() with his friends at the park later.

    This is my Blog!... The gaming Process
    Please check out my site: Giddel Creations

  8. #8
    Senior Member
    Join Date
    Aug 2005
    Posts
    225
    Quote Originally Posted by PhobiK
    I think what he means is that if you have a mc with a name consisting only of a number, is it possible to tell the movie (or a MC) to gotoAndPlay(myInstanceName).
    Yeah, it can be done this way:
    _root.hitPlace.gotoAndPlay(this._name);
    _root.backGround.gotoAndPlay(this._name);

    Or to be more precise _root.hitPlace.gotoAndPlay(Number(this._name));
    thanks! and sorry to for the vague question

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center