Server-side Variables (set and call)
A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Server-side Variables (set and call)

  1. #1
    Member
    Join Date
    Aug 2001
    Posts
    76

    Smile

    How can I set a variable on the server and then call that variable when I need it?

    For example, I would like to set a server variable "User1Name" which is created by logging in.
    And then call that variable to be used in the following line...
    srcStream.play("User1Name")

    Thanks in advance

  2. #2
    Danny Gomez Creations cosmiceye's Avatar
    Join Date
    Mar 2002
    Location
    under a palmtree in Jamaica waiting for psytopia 2005 to begin
    Posts
    982
    serverside:
    Code:
    application.onConnect = function(newClient, name){
            var username;
    	username=newClient.name;
    	newClient.call("setsrcStream", null, username);
    }
    client side:
    Code:
    client_nc.setsrcStream = function(username) {
    	var username;
    	srcStream.play(username);
    
    }
    ...did I get it right??

  3. #3
    Member
    Join Date
    Aug 2001
    Posts
    76
    My app has changed quite a bit since my first post so let me ask my question again with more specifics.

    First off, the only component I'm using is the People List.
    My app separates users from the beginning into 2 groups: the speaker or admin; and everyone else.

    When regular users log on, they publish a video stream using their unique name. The video does not start yet.

    Everyone can view the people list but only the speaker can click on a name to execute a function. When the speaker does click on a name, I would like that persons stream to begin playing for all users.

    Basically the speaker gets to decide who everyone sees.

    The Problem.
    I can make a shared object which keeps each users unique name. How can I call that unique name and send it to the
    myStream.play(***unique name***) automatically playing the video for all users?

    BTW: the unique name is located here...
    stream_so.data.name

    Please let me know if I need to give more info.
    Thanks

  4. #4
    psx = new Moderator();
    Join Date
    Jan 2001
    Posts
    923
    still not quite sure - but from your post, I'm thinking you want the admin user to click on a user name in the people list, and then have that person's stream to play for each user?

    Seems you want to have the name of the user on a shared object (you may have already) - so some client side code would be like:
    Code:
    function onSelectUser () {
    selectedUser = people_lb.getSelectedItem().label;
    stream_so.data.name = selectedStream;
    }
    Then the onSync function for stream_so:
    Code:
    stream_so.onSync  = function() {
    myStream.play(stream_so.data.name)
    }

    Granted - that is using a simple listbox component for the people list, instead of the People list component. I haven't messed with the components much, but it seems that it's merely a listbox with some extras. Look it up in the pdf that comes with the components, I'm guessing there is a predefined method you can use to get the selected user.

    Hope that's what you are looking for?

    Psx


  5. #5
    Member
    Join Date
    Aug 2001
    Posts
    76
    That's exactly what I was asking!

    I figured out how to do it another dumbfangled way but this way looks much cleaner.

    I'll try to incorporate this.

    Thanks psychlonex

  6. #6
    psx = new Moderator();
    Join Date
    Jan 2001
    Posts
    923
    hehe - that doesn't happen to often!
    Glad I was on the right track and able to help.

    What inspired the name "PoopsMcGee" anyway? It's hilarious!

    You might appreciate this image:
    http://psychlonex.dyndns.com/poops/poop.jpg

    Psx

    ps. It's backwards because my cam sucks!

  7. #7
    Member
    Join Date
    Aug 2001
    Posts
    76
    "Tenacious D" reference 8-)

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

Poll by Flashkit.com