Re: [flexcoders] Function from string?

2013-11-06 Thread hamann . w
 I'm writing a game. Well, actually I guess it's more of a game engine. I 
 want the game logic to be in a script.  The script will take the form of 
 a series of rooms, each of which can contain:
 
. doors to other rooms
. characters the player can interact with
. things the player can pick up and use
 
 Any of these can have conditions on them. The condition can be expressed as:
. Player must have (thing) in his inventory
. Player must have at least X points
. Player must have at least $Y money
. Call function f
 
 That last seems to be a problem. I would like to be able to take a 
 function name I've read from the script and call the corresponding 
 function. Or, alternatively, the script can contain the name of a class 
 which must contain a method named (for example) conditionTest.
 
 But I haven't figured out a way to convert a string to either a Function 
 or a Class.  Is there a way of doing this?  If I were working in 
 Javascript, I'd just call eval, but that seems to be forbidden in AS3, 
 right?
 
 Can I do this? Or do I have to put all the functions I might want to 
 call this way in an array, and look them up that way?  Or what?
 
Hi,

you can call

this['funcname'] or similar if the class is known.
You can call getDefinition if you need to match the class name
It might make sense to have all the expected functions in an array, just to 
avoid
that a script error calls functions that should not

Regards
Wolfgang





Re: [flexcoders] pdf in flash/flex alternative to flexpaper?

2013-02-15 Thread hamann . w

Hi,

many years ago I successfully converted specific PDFs (they were all created by 
the same
generator and used a fixed set of fonts and drawing primitives)
The pipeline consisted of ghostscript to translate the pdf into uncompressed,
a perl script to convert the graphic instructions into ming source, and finally 
the perl
version of ming to create swf.
The resulting file is made of lines, areas, and static text..
Of course text could be reconstructed with the help of a decompiler, but it is 
possible to
generate the file so that no character / glyph index relation is present

The procedure was a bit tedious, and so the next time the same files were 
requested,
I built a solution that hooked into the publication process even before pdf 
generation

Regards
Wolfgang 




[flexcoders] link problem

2012-09-02 Thread hamann . w


Hi,

I am trying to build an AS only application with embedded assets.
The source comes with its own config, so I essentially use

mxmlc -output=bin/xyz.swf demos/src/xyz.as -load-config+=config.xml 
-include-libraries=abc.swc \
 -include-libraries=def.swc -static-link-runtime-shared-libraries 

The main class references the embedded material via

import embeds.*

the embeds look like

package embeds
{  public class assetdata
   [Embed(source = asstes/Abcd.css, mimeType = application/octet-stream)]
   public static const Abcd:Class;
.
}

The generated swf does not include ByteArrayAsset and consequently complains 
about
Abcd as well.

Since my own projects have a quite similar structure, I would guess that one of 
the external
swc interferes here. Could anybody shed some light on that?

Greetings
Wolfgang Hamann



Re: [flexcoders] focus manager questions

2010-09-05 Thread hamann . w
Hi Alex,

thanks for responding. I am probably just looking in the wrong direction, but a 
test
application as simple as

package
{
 import flash.display.MovieClip;

 public class test extends MovieClip
 {
public function test()
{
 trace(this.focusManager);
}
 }
}

does not compile in mxmlc.

Best regards
Wolfgang Hamann


 
 If you are using Flex applications, there shouldn=92t be a yellow rectangle=
 , and there should be a focusManager variable.
 
 
 On 9/4/10 1:38 AM, haman...@t-online.de haman...@t-online.de wrote:
 
 
 Hi,
 
 is there a simple way to
 a) get rid of the yellow rectangle (the object listens to focusin and focus=
 out event in order
 to display its focussed state)
 b) get a handle on the (application) focus manager (in order to use its set=
 Focus() method instead of
 setting stage.focus)
 
 Many thanks
 Wolfgang Hamann
 

package
{
 import flash.display.MovieClip;

 public class test extends MovieClip
 {
public function test()
{
 trace(this.focusManager);
}
 }
}






[flexcoders] focus manager questions

2010-09-04 Thread hamann . w


Hi,

is there a simple way to
a) get rid of the yellow rectangle (the object listens to focusin and focusout 
event in order
to display its focussed state)
b) get a handle on the (application) focus manager (in order to use its 
setFocus() method instead of
setting stage.focus)

Many thanks
Wolfgang Hamann 



[flexcoders] local clipboard

2010-09-04 Thread hamann . w

Hi,

I would like to follow the suggestions and implement a local clipboard by 
capturing
keystrokes (ctl-c, ctl-v, ctl-a for select all). Unfortunately, FP10 (on 
linux) returns
a keycode of 0x for all 3 of these. The same is true when running 
inside a browser.
Is there a way to get these codes (perhaps at the
cost of no longer using the system clipboard)?

Another keyboard issue: with FP9, the ALT key was available to the application.
With FP10, ALT dragging will move the entire FP on the screen

Wolfgang Hamann




Re: [flexcoders] AMFPHP Security?

2010-08-11 Thread hamann . w

Clark Stevenson wrote:
Hi all.

I am new to AMFPHP.  Lets say you have a class and a function:

SomeClass.saveHighScore(304958);

For me, the way i see it, is that anyone using Charles can call this
method? Whats to stop anyone from calling it directly?

SomeClass.saveHighScore(20394948548438484).


Can any one advise me on ways i could secure this method?

Hi Clark,

first of all, there is no secure method; you can just make it harder.

Consider this scenario:
the website uses a server session. When the game starts, or just prior to
sending highscore, the movie asks the server for some token (which will
be stored in the serverside session data)
Now the movie performs some calculations with the token and the value,
and sends result of calculation.
Server can verify that the client was indeed using the token matching its
session ID. The calculation is sort of a crypt thing, obviously

Wolfgang