File analysis
[1/5] from: richard:coffre:francetelecom at: 22-Apr-2002 15:59
Hi Rebollers,
I have to study a Flash application. To do so I extract all the code with
Action Script Viewer and I got a Text File.
But now I want to find the code associated to each function and to create
for each function found a file with its code.
Hereafter a sample of the file.
The example that follows shows the link between the function "CalcDaysInFeb"
and its code located at "Symbol 317 MovieClip Frame 15".
TIA
rc
This sample below shows the link between a function and its name in the file
(this excerpt is located at the end of the file ) :
dummy
Symbol 316 MovieClip Frame 2
CheckDate
Symbol 317 MovieClip Frame 5
CalcDaysInFeb
Symbol 317 MovieClip Frame 15
FormatDate
Symbol 318 MovieClip Frame 5
CheckValid
Symbol 318 MovieClip Frame 15
DummyDate
Symbol 342 MovieClip Frame 15
Now this is the main part of the file where the code is defined :
----------------------------------------------------------------------
Symbol 317 MovieClip Frame 5
----------------------------------------------------------------------
Trace("In CheckDate")
Set Variable: "result" = ""
If (not (checkDay < 1) and not (31 < checkDay))
Trace(("Day " & checkDay) & " is valid")
If (not (checkMonth < 1) and not (12 < checkMonth))
Trace(("Month " & checkMonth) & " is valid")
If (Length (checkYear) = 4)
Trace(("Year " & checkYear) & " has 4 digits")
If (not (Eval("daysInMonth" & checkMonth) < checkDay))
Trace((("Day " & checkDay) & " <= ") &
Eval("daysInMonth" & checkMonth))
If (checkMonth = 2)
Call ("CalcDaysInFeb")
If (not (daysInFebruary < checkDay))
Set Variable: "result" = "ok"
End If
Else
Set Variable: "result" = "ok"
End If
End If
Else
Trace(("Year " & checkYear) & " is invalid")
End If
Else
Trace(("Month " & checkMonth) & " is invalid")
End If
Else
Trace(("Day " & checkDay) & " is invalid")
End If
----------------------------------------------------------------------
Symbol 317 MovieClip Frame 15
----------------------------------------------------------------------
Trace("Calculating days in Feb for " & checkYear)
Set Variable: "daysInFebruary" = 28
Set Variable: "divBy4" = 0
Set Variable: "divBy100" = 0
Set Variable: "divBy400" = 0
If ((checkYear / 4) = Int (checkYear / 4))
Trace(checkYear & " divisible by 4")
Set Variable: "divBy4" = 1
End If
If ((checkYear / 100) = Int (checkYear / 100))
Trace(checkYear & " divisible by 100")
Set Variable: "divBy100" = 1
End If
If ((checkYear / 400) = Int (checkYear / 400))
Trace(checkYear & " divisible by 400")
Set Variable: "divBy400" = 1
End If
If ((divBy4 = 1) and (not (divBy100 = 1) or (divBy400 = 1)))
Set Variable: "daysInFebruary" = 29
End If
Trace("daysInFebruary = " & daysInFebruary)
----------------------------------------------------------------------
Symbol 318 MovieClip Frame 1
----------------------------------------------------------------------
Stop
Set Variable: "pos1" = GetProperty ( "MonthMovie",_x )
Set Variable: "pos2" = GetProperty ( "DayMovie",_x )
Set Variable: "pos3" = GetProperty ( "YearMovie",_x )
Trace((((("pos 1 = " & pos1) & " pos2 = ") & pos2) & " pos3 = ") & pos3)
Set Variable: "dateFormat" = /Gen/UserConfig:dateFormat
Trace("dateFormat is " & dateFormat)
If (dateFormat eq "DMY")
Set Property ("DayMovie", X Position) = pos1
Set Property ("MonthMovie", X Position) = pos2
Else
If (dateFormat eq "MDY")
Set Property ("MonthMovie", X Position) = pos1
Set Property ("DayMovie", X Position) = pos2
End If
End If
----------------------------------------------------------------------
Symbol 318 MovieClip Frame 5
----------------------------------------------------------------------
Set Variable: "tmpYear" = (20 & YearMovie:value) & 0000
Richard Coffre
France Telecom Orbiscom
Tél. : 01 47 61 46 28
Share what you know, learn what you don't
[2/5] from: oliva:david:seznam:cz at: 22-Apr-2002 19:39
Hello COFFRE,
I'm really interested, do I understand it well, that you just want to
write some simple parser that will join the function name to the
propper code? I would like to try the Action Script Viewer at home
(where to download it)...
for some more exploration you can use my exam-swf.r script (it's part
of the Rebol/Flash dialect zip archive at http://oldes.multimedia.cz/swf/)
My script is not perfect because it's not complete yet and I use it
just to hack the structure of my testing flash files, but may be
usefull as well.
cheers oldes
[3/5] from: pyxos:netcourrier at: 22-Apr-2002 21:47
Hi Oliva
The best for me should to split it into separate files for each function but I think
reading your mail that a first step joining the name and the code should good. I'll read
your code.
To download a demo of Action Script Viewer go to http://buraks.com/asv/.
Regards
Richard
----Message d'origine----
>Date: Mon, 22 Apr 2002 19:39:08 +0200
>De: rebol-list <oliva.david=40seznam.cz>
<<quoted lines omitted: 15>>
>rebol-request=40rebol.com with =22unsubscribe=22 in the
>subject, without the quotes.
-------------------------------------------------
=22Sound Mind, Sound Body=22 Juv=E9nal
=22Lire et =EAtre curieux, c'est la m=EAme chose=22 Pascal Quignard
=22Qui triomphe de lui-m=EAme poss=E8de la force=22 Lao-Tseu, extrait du Tao Te King
=22Dans la course =E0 la qualit=E9, il n'y a pas de ligne d'arriv=E9e=22 David Kearns
Allez voir mon site : http://www.desala.org
-------------------------------------------------------------
NetCourrier, votre bureau virtuel sur Internet : Mail, Agenda, Clubs, Toolbar...
Web/Wap : www.netcourrier.com
T=E9l=E9phone/Fax : 08 92 69 00 21 (0,34 =80 TTC/min)
Minitel: 3615 NETCOURRIER (0,15 =80 TTC/min)
[4/5] from: richard:coffre:francetelecom at: 23-Apr-2002 9:49
Oliva,
When I run your script as follows :
>> do %flash/make-swf/exam-swf.r %appflash.swf
Script: "SWF Examiner" (17-Dec-2001)
== %appflash.swf
>>
But I see nowhere the result of the analysis.
What should I see ?
Richard
-----Message d'origine-----
De : rebol-list [mailto:[oliva--david--seznam--cz]]
Envoy=E9 : lundi 22 avril 2002 19:39
=C0 : COFFRE Richard FTO
Objet : [REBOL] Re: File analysis
Hello COFFRE,
I'm really interested, do I understand it well, that you just want to
write some simple parser that will join the function name to the
propper code? I would like to try the Action Script Viewer at home
(where to download it)...
for some more exploration you can use my exam-swf.r script (it's part
of the Rebol/Flash dialect zip archive at http://oldes.multimedia.cz/swf/)
My script is not perfect because it's not complete yet and I use it
just to hack the structure of my testing flash files, but may be
usefull as well.
cheers oldes
[5/5] from: oliva:david:seznam:cz at: 29-Apr-2002 23:42
Hello COFFRE,
Tuesday, April 23, 2002, 9:49:07 AM, you wrote:
CRF> Oliva,
CRF> When I run your script as follows :
>>> do %flash/make-swf/exam-swf.r %appflash.swf
CRF> Script: "SWF Examiner" (17-Dec-2001)
CRF> == %appflash.swf
>>>
CRF> But I see nowhere the result of the analysis.
CRF> What should I see ?
Sorry for very late reply (I was not connected yet)
Exam-swf.r script is not just one function but more functions. The
main is the 'exam-swf
so if you have the script loaded :
>> do %exam-swf.r
>> exam-swf
SWF file:new.swf
Searching the binary file... swf size: 56 bytes
-------------------------
make object! [
version: 5
length: 56
frame-size: [0 6400 0 6400]
frame-rate: 60
frame-count: 1
]
setBackgroundColor(9): 153.165.139
DoAction Tag(12):
ActionPush #{006163636F756E7400} ["account"]
ActionGetVariable #{1C} #{}
ActionPush #{006E616D6500} ["name"]
ActionGetMember #{4E} #{}
ActionDelete #{3A} #{}
END of ActionRecord #{00} #{}
showFrame(1):
end(0):
>>
I've updated the file now (because I was improving it a little bit to
show some FlashMX tags properly) and add /quiet switch so the
informations are not printed byt just swf object is returned:
>> exam-swf/quiet
SWF file:new.swf
>> probe swf
make object! [
header:
make object! [
version: 5
length: 56
frame-size: [0 6400 0 6400]
frame-rate: 60
frame-count: 1
]
rect: none
data: [[9 3 #{99A58B}] [12 25 #{960900006163636F756E74001C960600006E616D65004E3A00}]
[1 0 #{}] [0 0 #{}]]
]
>>
You may see that there are the Flash tags as block in the swf/data so
you may work with them as for example:
>> parse-ActionRecord swf/data/2/3
ActionPush #{006163636F756E7400} ["account"]
ActionGetVariable #{1C} #{}
ActionPush #{006E616D6500} ["name"]
ActionGetMember #{4E} #{}
ActionDelete #{3A} #{}
END of ActionRecord #{00} #{}
But these functions are done to just print informations, not to return
pure data (I've modified some of the functions to also return the data
in the %exam-swf-mod.r that replaces some of the parsing functions
(this is not complete yet) There is still a lot of thinks, that should be
fixed or improved.
cheers Oldes
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted