Sie sind nicht angemeldet.

Zephyr

Profi

  • »Zephyr« ist der Autor dieses Themas

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

1

Dienstag, 10. Februar 2009, 09:53

URL encoding?

Hi,

I have made a plugin that reads an external xml and uses its data to show info, loads a still image etc. I came across this problem, and can't figure it out if its a URL encoding error, security issue or something else.

This works:

Quellcode

1
2
3
4
5
6
<plugin 
url="plugins/still.swf?req=somexml.xml"
zorder="97" 
align="center" x="0" y="0" 
children="true" visible="false" cursor="false" handcursor="false" 
/>


This doesn't (check the url, not a real adress btw)

Quellcode

1
2
3
4
5
6
<plugin 
url="plugins/still.swf?req=http://somewebsite.com/somexml.xml"
zorder="97" 
align="center" x="0" y="0" 
children="true" visible="false" cursor="false" handcursor="false" 
/>


This doesn't work either (it loads only the req and not var2, and if I turn them around, it loads var2 and not req)

Quellcode

1
2
3
4
5
6
<plugin 
 url="plugins/still.swf?req=somexml.xml&var2=someothervariable"
 zorder="97" 
 align="center" x="0" y="0" 
 children="true" visible="false" cursor="false" handcursor="false" 
 />


Flash tracer plugin doesn't give me any sandbox security errors or any other errors, krpano debugger says it can't find the file.
Anyone got any clue?

Btw I use this function in Flash, but Im almost 100% certain it's right and that the problem lies in the xml

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function startplugin(event:Event):void
{
krpano = krpano_as3_interface.getInstance();
if (loaderInfo.parameters.req==null) 
{
apireq = "blanco.xml";
} 
else
{
apireq = loaderInfo.parameters.req
}
/* if (loaderInfo.parameters.var2==null) 
{
apireq2 = "blanco.xml";
} 
else
{
apireq2 = loaderInfo.parameters.var2
}*/
RequestXML(apireq);
}


and crossdomain.xml, allowing all domains:

Quellcode

1
2
3
4
5
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*" secure="false"/>
<allow-http-request-headers-from domain="*" headers="*" secure="false"/>
</cross-domain-policy>

2

Mittwoch, 11. Februar 2009, 00:16

Hi,

I have tested this now,
for me passing parameters (also urls) is working (online and offline)...


did you use the Flex SDK (mxmlc) or Flash CS3 to build the plugin?
try to trace ALL parameters, maybe this helps to find the problem...

e.g - AS3:

Quellcode

1
2
3
4
5
6
7
8
krpano.trace(0xFF,"enable debug mode");
krpano.trace(0,"loaderInfo.parameters:");
			
var params:Object = loaderInfo.parameters;
for (var varname:String in params)
{
  krpano.trace(0,varname + "=" + params[varname]);
}


best regards,
Klaus

Zephyr

Profi

  • »Zephyr« ist der Autor dieses Themas

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

3

Mittwoch, 11. Februar 2009, 10:38

I've pasted the piece of code, and swithed the krpano.trace with a normal trace(for some reason krpano.trace never worked). But it doesn't trace anything (using flash tracer addon). So I thought maybe it gets stucks along the way so I put 2 traces before and after the parameter trace. Like this:

Quellcode

1
2
3
4
5
6
7
8
	trace("begin trace")
	var params:Object = loaderInfo.parameters;
	for (var varname:String in params)
	{  
	  trace(varname + "=" + params[varname])
	  //krpano.trace(0,varname + "=" + params[varname]);
	}
	trace("end trace")


If I link to: url="plugins/still.swf?req=http://www.darkgfx.com/ObjectDetails2.xml"
The trace output is completely empty (not even begin trace/end trace) and the still swf wont be loaded (not even interface stuff, is completely blanc)

If I link it to url="plugins/still.swf?req=ObjectDetails2.xml", it loads the still and

I get

Zitat


begin trace
req=ObjectDetails2.xml
end trace
I have no clue what so ever... It seems it's looking for a file called "still.swf?req=http://www.darkgfx.com/ObjectDetails2.xml" instead of still.swf with the req as parameter. Because the error krpano gives, is the same error you get when it cant find a picture.

Edit: When I remove http:// from the req it works! url="still.swf?req=www.darkgfx.com/ObjectDetails2.xml"
So I thought, ok it seems to deal with the / correctly, maybe it's the : I Url encode the all the slashes and : to

Quellcode

1
http%3A%2F%2F
and it works. Probally the : doesn't get encoded right?

4

Mittwoch, 11. Februar 2009, 21:16

Hi,

which browser and flashplayer version are you using?
I tested also passing a variable with "http://..." successfully

krpano.trace(0, ... ); traces to the krpano log,
but the first parameter means it is a debug message
(see also in krpano_as3_interface.as)

you could also write:
krpano.trace(krpano_as3_interface.DEBUG, ... );

but DEBUG messages are only shown, when the DEBUGMODE is enabled,
either via <krpano ... debugmode="true"> in the XML
or via - krpano.trace(0xFF,"enable debug mode"); in AS3

do you have this example online?
it would be interesting to test it, I have no idea why it shouldn't work...

best regards,
Klaus

Zephyr

Profi

  • »Zephyr« ist der Autor dieses Themas

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

5

Mittwoch, 25. Februar 2009, 14:57

Sorry for the late reply,

The debugmode works now. It seems that I copied an older version of krpano_as3_interface.as

For those reading the topic. Make sure you get krpano_as3_interface.as from http://krpano.com/docu/plugins/

and NOT the one in the zip of Flash CS3 plugin example @ http://krpano.com/examples/interface/

6

Mittwoch, 25. Februar 2009, 22:10

hi, yes you're right, sorry the Flash CS3 example is very old and outdated,
the example was build with the Flash CS3 30day trail version

Zephyr

Profi

  • »Zephyr« ist der Autor dieses Themas

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

7

Montag, 2. März 2009, 12:51

What's the type of the first argument in krpano.trace(0xFF,"enable debug mode");
The 2nd is a string, but im not sure of the first, seems a string to. It's for the dummy function Im trying to make so I don't get value is not a function error messages in flash ;p

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Zephyr« (2. März 2009, 16:54)


8

Dienstag, 3. März 2009, 00:10

Hi, the first parameter is a "Number", the second can be any string on this call

Ähnliche Themen