dcsimg
A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 38

Thread: techy question

  1. #1
    Member
    Join Date
    Aug 2003
    Posts
    34

    techy question

    I've got a project that seems simple in concept, but way over my head.
    How would I make a flash site that would notify me with a ring if someone pushed a button on my site? I'm sure I would have to be on the site myself, but I would not want anyone else to be rang... just me.

    Any ideas?

    Thank you so much for thinking about it.

    littlebee

  2. #2
    FCS dude Ultimate99's Avatar
    Join Date
    Mar 2003
    Location
    Tokyo, Japan
    Posts
    120
    Yes this can be done. The easiest way would be to use two movies. One would be for you and the other would be the bell ringer. Then when somebody presses the button it sends a function call to your movie through FCS and the sound rings. If you want it in a login setup style, then you will have to setup a name somewhere or variable to differentiate of who is who and have the sound only go off if it is you. At this time, the function can go to all clients.

    Steps to take:

    Build the ringing movie to ring the sound, make a function that will ring it.
    Connect to the server and setup the function that will call the function that will ring the sound. This should be done by having all clients connect up to a shared object and then just call functions on it.

    Build the ringer movie with a button that when pressed will call a function to send the function across the sharedobject (which everybody is connected to but only your movie has the function that will run).

    And that should just about do it.
    Read up on: Shared objects, sharedObject.send

    hope this helps a bit
    it's all about giving it a shot, then it just goes from there

    English blog: www.sti-media.com/blog
    Japanese blog: www.3enhancedesigners.com
    FCS Tutorials:www.flashcomguru.com

  3. #3
    Member
    Join Date
    Aug 2003
    Posts
    34
    boy you lost from the beginning. -

  4. #4
    Member
    Join Date
    Aug 2003
    Posts
    34
    k.. so
    i can build the build the ringing movie, but how do i build the functions?

  5. #5
    FCS dude Ultimate99's Avatar
    Join Date
    Mar 2003
    Location
    Tokyo, Japan
    Posts
    120
    Do you have the documentation that comes with FCS? If you installed it on your home PC then you can access them with your browser, if not then you can get the pdf's off of MM's site. Not sure what the URL is... but they are readily available.

    To make the functions you will need to just create a function that is attaced to the sharedObject that all clients are connected up to.

    So for example I have a sharedobject called my_so:

    my_so.send("ring");

    This will call the function "ring" that is connected to the sharedObject. So you'll have a function that looks something like this in your movie

    my_so.ring=function(){
    //ring da bell
    }

    and it will ring the bell because the function send is being called. What is happening here is that all clients are connecting to an item on the server, think of it as the middle man. A client tells the middle man to tell everbody to "ring". So the middle man shouts out to everybody that is around him to "ring", the clients all hear this and check what to do when they are told to "ring". Whereas your movie has the function on what to do, the others don't and will ignore the noisy middle man and you will "ring".

    Is that a bit more understandable? or am I way off..
    it's all about giving it a shot, then it just goes from there

    English blog: www.sti-media.com/blog
    Japanese blog: www.3enhancedesigners.com
    FCS Tutorials:www.flashcomguru.com

  6. #6
    Member
    Join Date
    Aug 2003
    Posts
    34
    yes... I'm starting to understand. thank you for the help.

    I do have the the documentaion and have been dancing through it but i'm not quite sure how I would attach the function you wrote to the shared object.

    // Create a local shared object
    my_so = SharedObject.getLocal("foo");

    // Then create a remote?

    Or do i need all of the connectoins the below reports?

    // Create a local shared object
    so = SharedObject.getLocal("foo");

    // Create a remote shared object that is not persistent on the server
    nc = new NetConnection();
    nc.connect("rtmp://server.domain.com/chat/room3";
    so = SharedObject.getRemote("users", nc.uri);
    so.connect(nc);

    // Create a remote shared object that is persistent on the server
    // but not on the client
    nc = new NetConnection();
    nc.connect("rtmp://server.domain.com/chat/room3";
    so = SharedObject.getRemote("users", nc.uri, true);
    so.connect(nc);

    // Create a remote shared object that is persistent on the server
    // and on the client
    nc = new NetConnection();
    nc.connect("rtmp://server.domain.com/chat/room3";
    so = SharedObject.getRemote("users", nc.uri, "/chat");
    so.connect(nc);




    Thank you so much.

    littlebee

  7. #7
    Member
    Join Date
    Aug 2003
    Posts
    34
    I put real effort into this one.

    ok.. here's where I'm at...
    on the user side the code is below:

    ------------------------------------------------
    // enable debug utility
    #include "Netdebug.as"

    stop();

    // Open connection to FlashCom
    my_nc = new NetConnection();

    // Handle debug status message
    my_nc.onStatus = function(info) {
    trace("Level: " + info.level + newline + "Code: " + info.code);
    }

    // Application instance
    my_nc.connect("rtmp:/remoteobjectsitetool");

    my_so.send("ring");
    -------------------------------------------------------

    with a button in the same movie that has the following code:

    on (release) {
    my_so.send("ring");
    }


    Then.. in the other movie that is supposed to hear the bell I've got the code:
    ------------------------------------
    // enable debug utility
    #include "Netdebug.as"

    stop();

    // Open connection to FlashCom
    my_nc = new NetConnection();

    // Handle debug status message
    my_nc.onStatus = function(info) {
    trace("Level: " + info.level + newline + "Code: " + info.code);
    }


    // Application instance
    my_nc.connect("rtmp:/remoteobjectsitetool");


    my_so.ring=function(){
    //ring da bell
    gotoAndPlay("ring");
    }
    ------------------------------------------------------

    It doesn't actually work, but I feel I'm getting alot closer.

    The actual files are on the server here:
    http://66.34.126.41/test/remoteobjectsitetooladmin.fla
    http://66.34.126.41/test/remoteobjectsitetooladmin.swf
    http://66.34.126.41/test/remoteobjectsitetool.fla
    http://66.34.126.41/test/remoteobjectsitetool.swf

    Thanks for the help!

  8. #8
    FCS dude Ultimate99's Avatar
    Join Date
    Mar 2003
    Location
    Tokyo, Japan
    Posts
    120
    You're getting really close.. but it'll never work unless you connect up the shared objects. Read up a bit on connecting them in the docs. I recommend putting the connect function inside your onStatus function for the netConnection. This is because you can't connect up the shared object until you have a connection to the server with the netConnection. If you get success there then the SO will connect up. Remember to also create the SO. As in:

    my_so=SharedObject.getRemote("ringer",nc.uri);

    this should get things going I think
    it's all about giving it a shot, then it just goes from there

    English blog: www.sti-media.com/blog
    Japanese blog: www.3enhancedesigners.com
    FCS Tutorials:www.flashcomguru.com

  9. #9
    Member
    Join Date
    Aug 2003
    Posts
    34
    grrr.. I've been working with this for some time. need more help!

  10. #10
    FCS dude Ultimate99's Avatar
    Join Date
    Mar 2003
    Location
    Tokyo, Japan
    Posts
    120
    I'm not sure what else to add here. You haven't connected up the SO in your code so I put that up, and mentioned what you need to read up on. What other kind of help are you looking for? By looking at what you have written, I see no reason why it wouldn't work if just connect the so properly.
    it's all about giving it a shot, then it just goes from there

    English blog: www.sti-media.com/blog
    Japanese blog: www.3enhancedesigners.com
    FCS Tutorials:www.flashcomguru.com

  11. #11
    Member
    Join Date
    Aug 2003
    Posts
    34
    well I've read it up and down but don't yet understand how to write the code to connect it.
    Could you give me an example of a connection that might apply?

    Thank you sincerely.

  12. #12
    FCS dude Ultimate99's Avatar
    Join Date
    Mar 2003
    Location
    Tokyo, Japan
    Posts
    120
    Page 90 of the pdf for client side actionscript..
    Example

    The following example connects to a shared object and initializes it.

    function getMaster()
    {
    trace("getMaster called");
    master = SharedObject.getRemote("master", con.uri, true);
    connVal = master.connect(con);
    if (connVal) print("Connection was successful");
    else print("Unable to connect the shared object with the given NetConnection object");

    master.onSync = function (listVal) {
    getPlayList();
    trace("SO: " + so.data[currentPlaylist]);
    }
    }

    Keeping in mind that by setting the permanancy boolean to true, it will create a sharedobject that will be permanent on the server. If you put it to false it will be deleted when the application is unloaded off of the server.
    it's all about giving it a shot, then it just goes from there

    English blog: www.sti-media.com/blog
    Japanese blog: www.3enhancedesigners.com
    FCS Tutorials:www.flashcomguru.com

  13. #13
    Member
    Join Date
    Aug 2003
    Posts
    34

    Still having troubles...

    My admin side code is this:

    ----------------------------------------
    // enable debug utility
    #include "Netdebug.as"

    stop();

    // share objects
    function getMaster()
    {
    trace("getMaster called");
    master = SharedObject.getRemote("master", con.uri, true);
    connVal = master.connect(con);
    if (connVal) print("Connection was successful");
    else print("Unable to connect the shared object with the given NetConnection object");

    master.onSync = function (listVal) {
    getPlayList();
    trace("SO: " + so.data[currentPlaylist]);
    }
    }

    // Open connection to FlashCom
    my_nc = new NetConnection();

    // Handle debug status message
    my_nc.onStatus = function(info) {
    trace("Level: " + info.level + newline + "Code: " + info.code);
    }


    // Application instance
    my_nc.connect("rtmp:/remoteobjectsitetool");


    my_so.ring=function(){
    //ring da bell
    gotoAndPlay("ring");
    }
    -----------------------------------------------


    and my client side is:

    ------------------------------------------
    // enable debug utility
    #include "Netdebug.as"

    stop();

    function getMaster()
    {
    trace("getMaster called");
    master = SharedObject.getRemote("master", con.uri, true);
    connVal = master.connect(con);
    if (connVal) print("Connection was successful");
    else print("Unable to connect the shared object with the given NetConnection object");

    master.onSync = function (listVal) {
    getPlayList();
    trace("SO: " + so.data[currentPlaylist]);
    }
    }

    // Open connection to FlashCom
    my_nc = new NetConnection();

    // Handle debug status message
    my_nc.onStatus = function(info) {
    trace("Level: " + info.level + newline + "Code: " + info.code);
    }

    // Application instance
    my_nc.connect("rtmp:/remoteobjectsitetool");

    my_so.send("ring");
    -----------------------------------

    with the button code:
    on (release) {
    my_so.send("ring");
    }

    I'm getting the errors:
    Scene=Scene 1, Layer=Layer 2, Frame=1: Line 16: Wrong number of parameters; print requires exactly 2.
    if (connVal) print("Connection was successful");

    Scene=Scene 1, Layer=Layer 2, Frame=1: Line 17: Wrong number of parameters; print requires exactly 2.
    else print("Unable to connect the shared object with the given NetConnection object");


    The admin side just rings and rings..

    Any ideas?

    Thank you.

    http://66.34.126.41/test/remoteobjectsitetooladmin.fla
    http://66.34.126.41/test/remoteobjectsitetooladmin.swf
    http://66.34.126.41/test/remoteobjectsitetool.fla
    http://66.34.126.41/test/remoteobjectsitetool.swf
    Last edited by littlebee; 09-03-2003 at 11:56 AM.

  14. #14
    Member
    Join Date
    Aug 2003
    Posts
    34
    ultimate99 - where are you?

  15. #15
    FCS dude Ultimate99's Avatar
    Join Date
    Mar 2003
    Location
    Tokyo, Japan
    Posts
    120
    I was sleeping... I live in a different time zone than you do.

    What's with the print function? What does it do? I would suggest writing out your if sentences a bit different and it might work.

    if(something something){
    do something
    }else{
    do something else
    }
    it's all about giving it a shot, then it just goes from there

    English blog: www.sti-media.com/blog
    Japanese blog: www.3enhancedesigners.com
    FCS Tutorials:www.flashcomguru.com

  16. #16
    Member
    Join Date
    Aug 2003
    Posts
    34
    thanks for the help ultimate.

    Well.. I just deleted the print functions.. and it saves just fine.. but it still doesn't work execute. Pushing the button doesn't execute the bell on the other end.

    Would you take a look at the flas?

    Thanks a bunch.

  17. #17
    Member
    Join Date
    Aug 2003
    Posts
    34
    Would I perhaps need to write an ASC file?

  18. #18
    FCS dude Ultimate99's Avatar
    Join Date
    Mar 2003
    Location
    Tokyo, Japan
    Posts
    120
    First thing:

    Connecting to shared objects. You did read over the docs right? You have a mistake here:
    master = SharedObject.getRemote("master", con.uri, true);

    Why is this a mistake? Because you are using con.uri to connect to the server connection... you don't have con as a netConnection, you are using my_nc. So, you need to change that to my_mc.uri AND place your:

    // Open connection to FlashCom
    my_nc = new NetConnection();

    Above where you try to connect to the shared object. It's impossible to connect to a shared object on the server if you are not already connected up to the server.. Inside the my_nc.onStatus function place a pointer to a function to go get the shared object if the connection is a success. Something like this:

    my_nc.onStatus=function(info){
    if(info.code="NetConnection.connect.success"){
    go get my shared object;
    }else{
    we didn't connect up and there's an error
    }

    ALSO

    You have named your shared object master:

    master = SharedObject.getRemote("master", con.uri, true);

    but you are calling functions on my_so. You will need to use one of the names, not both or it won't work.

    maybe change the function to ring the bell to:

    master.ring=function(){
    //ring da bell
    gotoAndPlay("ring");
    }

    On a last note, I would suggest using the sound object to ring the bell instead of the timeline.. but either way will work I guess, and I'm not going to go into detail on that one.
    it's all about giving it a shot, then it just goes from there

    English blog: www.sti-media.com/blog
    Japanese blog: www.3enhancedesigners.com
    FCS Tutorials:www.flashcomguru.com

  19. #19
    Member
    Join Date
    Aug 2003
    Posts
    34

    getting closer... I just know it

    ok.. I did everything you said.. including making a ring function instead of a gotoAndPlay..

    The admin side looks like this

    -----------------------------------------------
    // enable debug utility
    #include "Netdebug.as"

    stop();

    // Open connection to FlashCom
    my_nc = new NetConnection();

    //create sound object
    ring = new Sound();
    ring.attachSound("ring");

    function getmy_nc()
    {
    trace("getmy_nc called");
    my_nc = SharedObject.getRemote("my_nc", my_nc.uri, true);
    connVal = my_nc.connect(con);

    my_nc.onSync = function (listVal) {
    getPlayList();
    trace("SO: " + so.data[currentPlaylist]);
    }
    }

    // Handle debug status message
    my_nc.onStatus = function(info) {
    if (info.code="NetConnection.connect.success"){
    my_nc.getRemote("my_nc", my_nc.uri, true)
    }
    }

    // Application instance
    my_nc.connect("rtmp:/remoteobjectsitetool");

    my_so.ring=function(){
    //ring da bell
    function playSound(){
    ring.start();
    }
    }
    ------------------------------------
    and the "other" side looks like this
    ------------------------------------
    // enable debug utility
    #include "Netdebug.as"

    stop();

    // Open connection to FlashCom
    my_nc = new NetConnection();

    function getmy_nc()
    {
    trace("getmy_nc called");
    my_nc = SharedObject.getRemote("my_nc", my_nc.uri, true);
    connVal = my_nc.connect(con);

    my_nc.onSync = function (listVal) {
    getPlayList();
    trace("SO: " + so.data[currentPlaylist]);
    }
    }

    // Handle debug status message
    my_nc.onStatus = function(info) {
    if (info.code="NetConnection.connect.success"){
    my_nc.getRemote("my_nc", my_nc.uri, true)
    }
    }

    // Application instance
    my_nc.connect("rtmp:/remoteobjectsitetool");

    my_so.send("ring");

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

    Do I need some kind of recieve function for the admin side?
    We got to be close right?

    thank you again so much.

  20. #20
    FCS dude Ultimate99's Avatar
    Join Date
    Mar 2003
    Location
    Tokyo, Japan
    Posts
    120
    connVal = my_nc.connect(con);

    What is the value of con? You will need to have your connection line in there, or set con to the connection line (rtmp://yourserver/yourapp")
    it's all about giving it a shot, then it just goes from there

    English blog: www.sti-media.com/blog
    Japanese blog: www.3enhancedesigners.com
    FCS Tutorials:www.flashcomguru.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