Solved

.NET Flash chat component not pulling in passed in socket and port address parameters

Posted on 2003-10-29
7
171 Views
Last Modified: 2010-07-27
Hi,

I am working on a Shockwave Flash Chat component intended to run under IIS .NET framework with a C# server and want to dynamically pull in server and port address information into the SWF file. I originally attempted to read a web.config xml file which worked fine outside of the IIS .NET environment, unfortunately under IIS it won't serve the config.web file for security reasons. So, it seems that I have to pass the information in as parameters from an .ASPX file, such as:

<embed src="Chat.swf?ipaddress=100.00.55.106&port1=2000" loop="false"
menu="false" quality="high" bgcolor="red" width="600" height="400"
name="Chat" align="middle" allowscriptaccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" />

Using this approach, I came up with the following code that is run in the SWF file when the user presses the 'Login' button:

on (release, keyPress "<Enter>") {

// put the user on a 'connection status page' while we load
gotoAndStop("attendere");

// try to connect
if (!socket.connect(ipaddress, port1)) {
trace("Connection failed!");
gotoAndStop("Errore");
}
}

However, it appers to NOT pull in the information.  From everything I have found on the web this is how I understand it to retrieve passed in parameters.  Why is this not working?  Does this perhaps also have to do with the .NET security?  How do I make it work?

A little frustrated,

-Steve

** advertising removed by Netminder, Site Admin **
0
Comment
Question by:falkan
  • 3
  • 2
7 Comments
 
LVL 27

Expert Comment

by:negatyve
ID: 9646732
Have you tried to trace "ipaddress" and "port1" values? For example, creating two textfields with those variables associated to, and checking for the textfields become populated with expected values?
0
 

Author Comment

by:falkan
ID: 9646809
Yes, if I do a direct connect like this, where Chat.aspx serves the SWF file:

http://10.0.55.106/ChatSetup/Chat.aspx

Content within Chat.aspx:

<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="50%">&nbsp;</td>
    <td><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="600" height="400" id="Chat" align="middle" >
        <param name="allowScriptAccess" value="sameDomain" />
        <param name="movie" value="Chat.swf" />
        <param name="loop" value="false" />
        <param name="menu" value="false" />
        <param name="quality" value="high" />
        <param name="bgcolor" value="#336699" />
        <embed src="Chat.swf?ipaddress=<%=System.Configuration.ConfigurationSettings.AppSettings["IPAddress"]%>&port1=<%=System.Configuration.ConfigurationSettings.AppSettings["PortNo"]%>" loop="false" menu="false" quality="high" bgcolor="red" width="600" height="400" name="Chat" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
        </embed>
      </object></td>
    <td width="50%">&nbsp;</td>
  </tr>

Then the values come up NULL.

But, if I serve the SWF directly like this:

http://10.0.55.106/ChatSetup/Chat.swf?ipaddress=10.0.55.106&port1=2000

Then the dynamic text boxes populate with the following proper information:

10.0.55.106
2000

0
 
LVL 27

Expert Comment

by:negatyve
ID: 9648855
I don't know .NET, but can you just show this line


<%=System.Configuration.ConfigurationSettings.AppSettings["IPAddress"]%>

in a aspx page? I mean, are you sure that this works?
0
 

Author Comment

by:falkan
ID: 9653806
Yes, I am sure that this works.  Simply, you can do a 'View Source' on the browser to make sure it resolves to the correct information, as such:

<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="50%">&nbsp;</td>
    <td><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="600" height="400" id="Chat" align="middle" >
        <param name="allowScriptAccess" value="sameDomain" />
        <param name="movie" value="Chat.swf" />
        <param name="loop" value="false" />
        <param name="menu" value="false" />
        <param name="quality" value="high" />
        <param name="bgcolor" value="#336699" />
        <embed src="Chat.swf?ipaddress=10.0.55.106&port1=2000" loop="false" menu="false" quality="high" bgcolor="red" width="600" height="400" name="Chat" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
        </embed>
      </object></td>
    <td width="50%">&nbsp;</td>
  </tr>

0
 
LVL 27

Accepted Solution

by:
negatyve earned 130 total points
ID: 9656132
try it this way:

<object
      classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
      codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
      width="600" height="400" id="Chat" align="middle" >
        <param name="allowScriptAccess" value="sameDomain" />
      <param name="FlashVars" value="ipaddress=<%=System.Configuration.ConfigurationSettings.AppSettings["IPAddress"]%>&port1=<%=System.Configuration.ConfigurationSettings.AppSettings["PortNo"]%>" />
        <param name="movie" value="Chat.swf" />
        <param name="loop" value="false" />
        <param name="menu" value="false" />
        <param name="quality" value="high" />
        <param name="bgcolor" value="#336699" />
        <embed
            src="Chat.swf"
            FlashVars="ipaddress=<%=System.Configuration.ConfigurationSettings.AppSettings["IPAddress"]%>&port1=<%=System.Configuration.ConfigurationSettings.AppSettings["PortNo"]%>"
            loop="false"
            menu="false"
            quality="high"
            bgcolor="red"
            width="600"
            height="400"
            name="Chat"
            align="middle"
            allowscriptaccess="sameDomain"
            type="application/x-shockwave-flash"
            pluginspage="http://www.macromedia.com/go/getflashplayer" />
      </embed>
</object>

if it doesn't work, just for test, change the:

<param name="allowScriptAccess" value="sameDomain" />

and

allowscriptaccess="sameDomain"

to

<param name="allowScriptAccess" value="always" />

and

allowscriptaccess="always"
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question