A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Flash Remoting and FlashComm Server

  1. #1
    Junior Member
    Join Date
    Aug 2000
    Posts
    9

    Flash Remoting and FlashComm Server

    Ok this is a pretty advanced question and I hoping that the mods in here are listening to this one. Mike C. if you are out there you input would be appreciated. Here goes:

    I'm having a problem with Flash remoting and using the Flash CommServer together with relation to the video. I have a FLV that is on stage but it is paused/stopped. I have a little app in a drag and drop window that allows a user to enter in a note to be emailed and when the "send" button is pressed, it calls a function that is defined on _level0 that is a connection to a Cold Fusion Componant. All the CFC does is recieve the variables passed to it (the users email addy and the message) and send the message via the SMTP connector in Cold Fusion to the Mail Server. This works with out a hitch.

    My problem is when I hit the send button, the video starts playing. (Not suppose to cause there is no call to do so) And second if I hit the send button again it spawns another instance of the video from the FlashCommServer and will keep doing so as long as I keep pushing it. I know this because I'm looking at the FlashComm Amdin window and watching it spawn new connections to the same video and all the videos are streaming back to my player. My question is where or not this is a bug with reguard to mixing Flash Remoting and FlashComm together.

    If you need to see the code email mail or pm me and I'll let you take a look at the application and some of the code if you need to. I could really use the help because I'm beating my head against the wall on this one.

    Thanks in advance,
    Bsmuv

  2. #2
    psx = new Moderator();
    Join Date
    Jan 2001
    Posts
    923
    That's a really weird issue! I've never seen that one, but I'm guessing it's not an issue with using flashcom and remoting in the same app. My only thought is that you have a name collision or something in the functions used to do the email send? If you want, post up some code, or email me directly at jrobinso@nycap.rr.com

    Psx

  3. #3
    Junior Member
    Join Date
    Aug 2000
    Posts
    9
    Ok for everyone looking to take a stabe at this one the code is listed below:

    Code:
    if (isGatewayOpen == null){
    	clearAll();
    	isGatewayOpen = true;
    	NetServices.setDefaultGatewayURL("127.0.0.1/flashservices/gateway");
    	_global.gatewayConnection = Netservices.createGatewayConnection();
    	_global.loginService = _global.gatewayConnection.getService("LoginModule.remoteLogin", this);
    	_global.projectService = _global.gatewayConnection.getService("MediaBox.remoteEntry", this);
    	_global.adminService = _global.gatewayConnection.getService("AdminModule.remoteAdmin", this);
    	_global.adminProjectService = _global.gatewayConnection.getService("ProducerModule.remoteAdmin", this);
    	_global.mailService = _global.gatewayConnection.getService("MediaBox.mailSend", this);
    	
    }
    
    
    startVideo = function(){
    	_global.myInputStream = new NetStream(_global.first_nc);
    	_level1.containerVideo.Video_mc.attachVideo(_global.myInputStream);
    	_global.myInputStream.setBufferTime(5);
    	_global.myInputStream.play(_global.videoTitle);
    }
    
    goConnect = function(){
    	connectSetting = ("rtmp://127.0.0.1/"+_global.fcommFolder);
    	_global.first_nc = new NetConnection();
    	_global.first_nc.connect(connectSetting);
    	_global.first_nc.onStatus = function(info){
    		if (info.code == "NetConnection.Connect.Success"){
    			_level0.startVideo();
    		}else if (info.code == "NetConnection.Connect.Rejected"){
    			first_nc.onStatus=null;
    		}else if (info.code == "NetConnection.Connect.Closed"){
    			
    		}
    	}
    }
    
    
    user_NoteSend = function(){
    	userEmail = _global.email;
    	userMsg = _global.sendMsg;
    	_global.mailService.noteSend(userEmail,userMsg);	
    }
    
    user_EmailSend = function(){
    	fromUser = (_global.fName+" "+_global.lName)
    	toEmail = _global.formEmail;
    	sendMsg = _global.sendMsg;
    	_global.mailService.emailSend(toEmail,fromUser,sendMsg);	
    }
    All of the code is in the first frame of _level0 and gets called by it function name. So when the video is called there is an action on a MovieClip that looks like this:

    Code:
    onClipEvent(load){
         _level0.goConnect();
    }
    The video is an embedded container for the FLV called from the FlashComm Server on _level1 in it's own MovieClip. This works without a hitch.

    The email part of the application is a separate swf file that gets loaded into _level1 into it's own movie clip. The only code on the "send" button is:

    Code:
    on(release){
    	if(msgTxt != null && msgTxt != "" && _global.formEmail != null){
    		_global.sendMsg = msgTxt;
    		if(_global.tempPath == "_level1.l"){
    			_level0.user_EmailSend();
    			this.gotoAndStop("Sent");
    		}else if(_global.tempPath == "_level1.r"){
    			_level0.user_EmailSend();
    			
    			this.gotoAndStop("Sent");
    		}
    	}
    }
    This part works and does not. It works because it makes the remoting connection to the CFC and the CFC processes the information and I get the email message like I'm suppose to. However it doesn't work because it is somehow firing off the goConnect() and either a: If the video is paused it restarts it or b: If the video is currently playing it spawns another instance of the video and both play one on top of the other and I can hear audio from both.

    If I monitor the FlashComm Server I can see that another instance of the video stream is being generated not just restarting the video stream. This is very confusing to me at this point and I'm kinda stuck. From what I can tell if you make a Flash/Cold Fusion remoting call it uses the NetServices.setDefaultGatewayURL(); and Netservices.createGatewayConnection(); functions and FlashComm Server uses NetConnection(); and connect(); so I really don't understand what is happening. Any insight from anyone is appreciated.

  4. #4
    Junior Member
    Join Date
    Aug 2000
    Posts
    9

    Ok.......

    I think I may have found a bug in the way Flash deals with remoting to a CFC with relation to function declaration in the first frame of the main time line.
    While doing some extensive debuging with several third party tools and with the Macromedia Debugger I have discovered that when the functions as listed above are on the main time line in the first frame, when they are called on subsequent frames or movieclips on other frames the player goes back to the frame the fuction is on (namely the first frame) without reloading the graphics of the or sound, but the scripts of every frame are reprocessed. Meaning for example if I have a script on frame one of the main time line that is the function that makes a call to a Cold Fusion Component. Then on frame two there are some other scripts that have nothing to do with the function on frame one. On frame three there are no scripts but there is a movieclip that has a button when clicked calls the function in frame one. Once the button is clicked, the player goes back to frame one and gets the function and then moves forward to frame two and does te actions on this frame again and then goes to frame three. Now I know what you are thinking, I just messed up and made the play head go back to frame one and play. But that's just it, the play head never moved. While carefully viewing the process on the Flash Debugger and looking at the properties the playhead never moves to redisplay any of the graphics on frames one or two, it stayes on frame three. So I guess my question is where do I report this and two has anyone else noticed this problem at all?

    Help?
    Bsmuv

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