Solved

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

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
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.

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now