Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL]

From: oliva:david:seznam:cz at: 20-Nov-2001 20:16

Flash dialect / parsing expressions =================================== Hi all... Ryan [[ryanc--iesco-dms--com]] wrote:
>I would rethink the whole approach. Data can be imprinted on gif, jpeg, png, >and bmp, and saved as a png or bmp using /View very easily, but forget about >swf. Could be done like so:
ech... why to forget about SWF? Flash is a toy in comparison with Rebol. I've started to make Flash file parsing script year ago but then I stoped because I had better things to do... now when I have free time as unemployed I decided to continue a litle bit so now I have script able to show all (and describe some) of the tags in the SWF file (upto version 4).... ... so .... Flash is tag based and the player ignores tags that doesn't know so it's not problem to add some own tags into the existing file if you need it.... ... I actually started to make dialect for creating Flash files as well.... so for example this code will create flash file that will contain two movies; one at position 100x100 and the second at 200x100 scaled to 50% and rotated by 20degrees and move the movie1 to position 0x0 at second frame and stop playing the main timeline (both movies continue playing if has more frames): rebol [ type: 'swf file: %new.swf background: 153.165.139 rate: 20 size: 320x240 ] EmptySprite 1 PlaceObject2 1 [name "movie1" depth 1 at 100x100] PlaceObject2 1 [name "movie2" depth 2 at 200x100] DoAction [ LoadMovie %logo5.swf "movie1" LoadMovie http://127.0.0.1/flash/phabal/hlava2.swf "movie2" SetProperties "movie2" [ScaleX 50 ScaleY 50 Rotate 20] ] showFrame PlaceObject2 1 [name "movie1" depth 1 move at 0x0] DoAction [stop] showFrame end ;---------------------------------------------------- OK... I've problems as well because I'm not parsing expert:-(and this is my first dialect:) Parsing expressions -=-=-=-=-=-=-=-=-=- This is working now: a: 1 ;or a: "some string" will be parsed by: ... | copy v set-word! set v2 [string! | integer!] ( form-act-tag #{96} rejoin [#{00} to-word first v #{00}] form-act-tag #{96} rejoin [#{00} v2 #{00}] ins-act #{1D} ;ActionSetVariable ) | ... that is in binary: ActionPush #{96} #{006100} ;--->is a as string! ActionPush #{96} #{003100} ;--->is 1 as string! ActionSetVariable #{1D} #{} Flash4 Actions model is stack based that means that the above code works in FlashPlayer as: 1. Pops value off the stack. 2. Pops name off the stack, which is a string naming the variable to set. 3. Sets the variable name in the current execution context to value. SO, how to make something more complicated like this: ----------------------------------------------------- I have 3 representations of the same simple operation: 1. In ActionScript: =================== Set Variable: "a" = 1 + 4 2. In Flash binary DoActionTag: =============================== ActionPush #{96} #{006100} ;--->is a as string! ActionPush #{96} #{003100} ;--->is 1 as string! ActionPush #{96} #{003400} ;--->is 4 as string! ActionAdd #{0A} #{} ActionSetVariable #{1D} #{} (DoAction Tag(12): 12 21 #{9603000061009603000031009603000034000A1D00}) 3. In Rebol: ============ a: 1 + 4 ......and the question is, how should look the Rebol parsing rule, that would create the correct Flash binary DoActionTag? and even more complicated example: 1. In ActionScript: =================== Set Variable: "a" = 1 + Random(10) 2. is in Flash binary DoActionTag: =============================== ActionPush #{96} #{006100} ;--->is a as string! ActionPush #{96} #{003100} ;--->is 1 as string! ActionPush #{96} #{00313000} ;--->is 10 as string! ActionRandomNumber #{30} #{} ActionAdd #{0A} #{} ActionSetVariable #{1D} #{} (DoAction Tag(12): 12 23 #{96030000610096030000310096040000313000300A1D00}) 3. should be in Rebol: ====================== a: 1 + random 10 ======================================================================================== That's all for now, if you are more interested or think you can help me, let me know.... Cheers Oldes