Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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. …
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
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 what frame rate is, how to control it and what effect it has on the video.

839 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