prev | index | next

local-with-networking
8
25
746 bytes
2282 bytes
2006-03-16 00:00:00
2006-03-16 21:18:24
Oldes (oliva.david@seznam.cz)


Just an example how to set local-with-networking flag in your file.

The same thing you can do with The Local Content Updater tool. More info about security (in Flash 8) is available here.

Bellow are some networking tests. The local-networking for socket will not be working anyway (on your local) because the connection is not allowed on the box.lebeda.ws domain.

(local-with-networking.rswf)

;!!! it must be the first tag !!!

UseNetwork on
;or:
;local-with-networking on
;or:
;network privileges on
;or:
;allow networking on
;================================


background 255.255.255
es: EmptySprite
m: place es
fnt_arial: Font [name "_sans"]
txt_data: EditText 'value 315x100 [
    WordWrap html text "Loaded" ReadOnly 
    Color #000000 Font [fnt_arial 12]
]
place txt_data
doAction [
    ;HERE ARE SOME NETWORKING TESTS

    ;?? this should limit access to network only for domain "box.lebeda.ws"
    System.exactSettings: true 
    System.security.allowDomain("box.lebeda.ws")
    
    ;will be the file from foreign domain loaded?
    m.loadMovie("http://laco.wz.cz/elasticboy.swf")
    
    
    value: "test"
    data_out: make LoadVars []
    data_in:  make LoadVars []
    data_out.c: "hello"
    data_out.sendAndLoad("http://box.lebeda.ws/~hmm/rswf/msg.php" data_in "get" )
    ;the data are not loaded if I'm running it from localhost,
    ;but the local-with-networking seems to have no effect:-(
    
    data_in.onLoad: func[][
        value: rejoin [value "^/<br><b>" data_in.value "</b>"]
    ]
]

show 14 frames
doAction [
    ;socket shoud work only on domain box.lebeda.ws, which is allowed on the server side
    _global.socket: make XMLSocket
    myOnConnect: func[success][
        value: reform [value "<br>^/socket connection:" success]
        socket.send((rejoin ["hello {rswf}"]))
    ]
    socket.onConnect: myOnConnect
    socket.onData:  func[src /local data][
        value: value add "#"
    ]
    socket.connect("box.lebeda.ws" 9000)
]
stop

showFrame
end