dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Controlling MCs with JS

  1. #1
    Member
    Join Date
    Aug 2000
    Location
    Cornwall, UK
    Posts
    44

    Controlling MCs with JS

    Hi all,

    I'm trying to get my head around Toolkit for CreateJS and am having problems getting to grips with the facility that exists for writing JS code directly into the Flash environment (so that when it's all published via the Toolkit for CreateJS extension it's ready to run). Sooooooo... does anyone have any idea how I can control the play/stop of a mc on the main time using the following tags?

    Code:
    /* js
    
    /*
    Everything seems to work fine if, say, I have a instance of 'btn_mc' on the main timeline and when it's clicked the main timeline plays at 'frame_whatever_label' e.g.

    Code:
    /* js 
    	this.onClick = function() { 
            this.gotoAndPlay("frame_whatever_label"); 
    } 
    
    */
    The above's no problem, runs like a dream. My difficulties lie in failing to grasp how to use a specific mc instance on the main timeline to control another mc instance on the main timeline. The normal way that it might have been targeted with actionscript doesn't seem to bear much relation to what the path should be in javascript... although this is probably down to me just being an ignoramus.

    See what I tried doing was...

    Code:
    /* js 
    	this.btn_mc.onClick = function() { 
            this.other_mc.gotoAndPlay("frame_whatever_label"); 
    } 
    
    */
    Anyway, apparently what I wrote there is absolute cobblers 'cos the published output is having none of it.

    I've obviously got a slash or a dot in the wrong place (or something!). Can anyone through an light on the matter?

    Cheers in advance for any help x

  2. #2
    Member
    Join Date
    Aug 2000
    Location
    Cornwall, UK
    Posts
    44
    Can anyone throw any light on the matter - not "Can anyone through an light on the matter"... sigh, it's been a long four days!

  3. #3
    Junior Member
    Join Date
    Oct 2012
    Location
    Nintendo Land
    Posts
    15
    Quote Originally Posted by Fran View Post
    Can anyone throw any light on the matter - not "Can anyone through an light on the matter"... sigh, it's been a long four days!
    No. According to the times and dates when this part I was quoting when posted its been 32 minutes. -.-

  4. #4
    Member
    Join Date
    Aug 2000
    Location
    Cornwall, UK
    Posts
    44
    Haha, I'd been working on it for four days before I even posted up! Lack of sleep, it's good if you learn to love it ;-)

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