Solved

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

Posted on 2003-10-29
7
169 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
3D rotation for a product 3 340
anti-download video publishing site? 6 615
Action Script commands 4 314
Windows 2008 Group Policy - An error occurred. Please try again later 2 87
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

777 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