A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: transfering variables --- HELPPPP

  1. #1
    Junior Member
    Join Date
    Jul 2000
    Posts
    15

    <SCRIPT language=javascript>

    var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
    var theMovie = InternetExplorer ? window.ourMovie : window.document.ourMovie;

    WM_setCookie('cookie', 'true');
    var beenhere = WM_readCookie('cookie');

    if (beenhere == "true") {
    theMovie.SetVariable("switch", "true");
    }

    </script>

    <BODY bgcolor="#FFFFFF">
    <OBJECT classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000"
    codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0" ID=ourMovie WIDTH =100 % HEIGHT =100 %>
    <PARAM NAME=Movie VALUE="intro.swf">
    <PARAM NAME=quality VALUE=high>
    <PARAM NAME=bgcolor VALUE=#FFFFFF>
    <EMBED NAME="ourMovie" src="intro.swf" quality=high bgcolor=#FFFFFF WIDTH =100 % HEIGHT =100 % TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>
    </OBJECT>

    ----------------------------

    This is giving me an error ... "'theMovie' is not an object"
    This is also giving me a headache but I cant figure it out ... its probably something simple ....

    Thanx


  2. #2
    Senior Member
    Join Date
    Jul 2000
    Posts
    114

    hmmmm

    Well, I could be wrong here, but here goes.....

    When it is giving you the error that 'theMovie' is not an object it is because of the line:
    theMovie.SetVariable("switch", "true");
    in this line you are saying to set the variable "switch" to true inside of the "object"/container theMovie.
    However, you have set up the movie as a variable....not an object containing other variables and possibly functions.

    I would try:
    if (beenhere == "true") {
    theMovie = "true";
    }


    That will set your variable to true without any of the object problems.

    Hope this helps,

    Spliffster



  3. #3
    Senior Member
    Join Date
    Jul 2000
    Posts
    114

    oops

    A little addon,

    Actually, you would want to set theMovie like so....

    theMovie = true;

    because if you put the quotes around true it will be setting it to a string containing "true", as opposed to the true/false value I assume you're looking for.

    Spliffster

  4. #4
    Junior Member
    Join Date
    Jul 2000
    Posts
    15
    doesnt work?!? any other suggestions?

  5. #5
    Senior Member
    Join Date
    Jul 2000
    Posts
    114

    ?

    What about it doesn't work...are you getting any error messages now or does it just not do what you were hoping for??

  6. #6
    Junior Member
    Join Date
    Jul 2000
    Posts
    15
    sorry .... it gives me an "Object doesn't support this property or method" error

  7. #7
    Senior Member
    Join Date
    Jul 2000
    Posts
    114

    well...

    Maybe you should just try setting up a new variable to hold the switch value. Then check this value later on in your program.

    eg

    if (beenhere == "true") {
    var switch = true;
    }

    Hope this is helping and I'm not just making it worse :-)

    Spliffster

  8. #8
    Junior Member
    Join Date
    Jul 2000
    Posts
    15
    still no work ... could this be the error?

    the line i am recieving the error on is the same line which transfers the variables to flash ... here is the first flash frame it hits ...

    If (switch eq "true")
    Go to and Play (Scene 1, 225)
    Else If (switch eq "false")
    Go to and Stop (2)
    End If

    Could it be choking here?

  9. #9
    Senior Member
    Join Date
    Jul 2000
    Posts
    114

    looks ok

    That looks ok, assuming that the variables are getting passed into flash properly.

    Have you checked to see what the value you get for switch is using the output window??

    if you felt like sending me the fla, or a piece of it I could take a look for you....if not just keep asking and I'll do my best to answer

  10. #10
    Junior Member
    Join Date
    Jul 2000
    Posts
    15
    sorry i took so long . im trying to figure this out. ok, ive come to this point ...


    var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
    var theMovie = InternetExplorer ? window.intro : window.document.intro;
    WM_setCookie('cookie', 'false');
    var info = WM_readCookie('cookie');
    theMovie.SetVariable("abc",info);

    ---------

    in flash:

    If (abc = "true")
    Go to and Play (Scene 1, 225)
    Else If (abc = "false")
    Go to and Play (2)
    End If


    ---------

    After this, i still get

    'theMovie' is not an object





  11. #11
    Senior Member
    Join Date
    Jul 2000
    Posts
    114
    Well.....the reason you are getting the "is not an object" error is because theMovie is not an object, it's just a variable.
    It's not set up properly to accept other variables into itself and contain them. Unfortunately, i'm not really sure how to set it up as an object.
    One alternative I would suggest is starting another thread and just asking how to send a variable from Javascript to a flash movie.
    If we can get a good answer to that I think I can help you get it all working properly.

    if you need to email me, feel free, it's splifffster@hotmail.com

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