SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2001
    Location
    Luton, UK
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Variables I just can't get right!!

    Hi All
    I figured this would be easy but for some reason I can't get it right.

    I have a movie clip that loads a video and streams it. But what I want to do is have the video stream first time but second time it is loaded to go to a stop position.

    I have defined a variable x=1; in a movie clip called movieVar - and on the button that calls the video.swf I have put

    on(release)
    {
    _root.movieVar.x=x++;
    }


    Now in the video .swf on frame 1 I have put:

    if(_root.movieVar.x >= 2){
    gotoAndPlay(2);
    }else{
    gotoAndStop("videoStop" );
    }


    When I first load the video.swf the x variable in movieVar says 'undefined' but when I click the button again to load it it does give it a value of 1 - and then I press again and it goes to 2.

    So why is it saying undefined when the button is pressed for the first time?

    Any ideas where I am going wrong?

    All help much appreciated.

    Drew
    Last edited by drewcoster; Mar 12, 2003 at 11:33.
    'As a computer, I find your faith in technology amusing'

  2. #2
    SitePoint Zealot webQS's Avatar
    Join Date
    Oct 2002
    Location
    Sydney : Australia
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi

    Try setting the initial variable in the frame before where the video containing clip is introduced.
    Also, try using more descriptive variables. Flash might be getting x mixed up with _x defining the xpos of the clip.

    My other thoughts would be to set the video variable at the end of the loaded video. In the containing clip:
    Code:
    this.vidPlayedOnce=true;
    Then at the start of the video containing clip:
    Code:
    if(!this.vidPlayedOnce)
    {
     gotoAndPlay(2);
    }
    else
    {
    gotoAndStop("videoStop" );
    }
    HTH
    Cheers
    James

    Quote Originally Posted by drewcoster
    Hi All
    I figured this would be easy but for some reason I can't get it right.

    I have a movie clip that loads a video and streams it. But what I want to do is have the video stream first time but second time it is loaded to go to a stop position.

    I have defined a variable x=1; in a movie clip called movieVar - and on the button that calls the video.swf I have put

    on(release)
    {
    _root.movieVar.x=x++;
    }


    Now in the video .swf on frame 1 I have put:

    if(_root.movieVar.x >= 2){
    gotoAndPlay(2);
    }else{
    gotoAndStop("videoStop" );
    }


    When I first load the video.swf the x variable in movieVar says 'undefined' but when I click the button again to load it it does give it a value of 1 - and then I press again and it goes to 2.

    So why is it saying undefined when the button is pressed for the first time?

    Any ideas where I am going wrong?

    All help much appreciated.

    Drew

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2001
    Location
    Luton, UK
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi James

    Thanks for responding.

    In the end I just put the variables on the main timeline and it worked fine.
    But thanks for the idea anyway.

    Cheers,

    Drew
    'As a computer, I find your faith in technology amusing'


Bookmarks

Posting Permissions

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