Test XML
Submitted by GROL on 1 October, 2010 - 11:13

Convert SWF to XML file and vice versa. Using ActionScript and Motion features is possible.
Note. Delphi SWF SDK Expert edition is needed for compiling.
Source archive: testxml.zip (0.9Mb)
Also see XML tags specification
Some sample source:
procedure TdlgName.bMakeXMLClick(Sender: TObject); var Stt: string; begin OD.Filter := 'SWF|*.swf'; if OD.Execute then begin Screen.Cursor := crHourGlass; SWF := TSWFStreamReader.Create(''); With SWF.XMLReadWriteSettings do begin BasePath := ExtractFilePath(OD.FileName); if CBExt.Checked then AsExternal := [lpImage, lpSound, lpVideo, lpNotIdentified] else AsExternal := []; if CBFontExt.Checked then AsExternal := AsExternal + [lpFont]; if CBActionExt.Checked then AsExternal := AsExternal + [lpActions]; FontAsByteCode := CBFBytecode.Checked; ActionsAsByteCode := CBABytecode.Checked; if CBSubFolder.Checked then begin Stt := BasePath + ChangeFileExt(ExtractFileName(OD.FileName), '.files'); // uncoment for testing releative path // stt := 'c:\temp\' + ChangeFileExt(ExtractFileName(OD.FileName), '.files'); SomePath := CBSomeFolder.Checked; if CBSomeFolder.Checked then begin Path := Stt; CreateDir(Path); end else begin PathImage := Stt + '_I'; CreateDir(PathImage); PathSound := Stt + '_S'; CreateDir(PathSound); PathVideo := Stt + '_V'; CreateDir(PathVideo); PathFont := Stt + '_F'; CreateDir(PathFont); PathActions := Stt + '_A'; CreateDir(PathActions); end; end else FilePrefix := ChangeFileExt(ExtractFileName(OD.FileName), '_'); end; SWF.OnProgress := onProcess; SWF.LoadFromFile(OD.FileName); SWF.SaveToXMLFile(ChangeFileExt(OD.FileName, '.xml')); SWF.Free; label1.Caption := ''; ProgressBar.Position := 0; Screen.Cursor := crDefault; end; end; procedure TdlgName.bMakeSWFClick(Sender: TObject); var BaseSWF: TBasedSWFStream; begin OD.Filter := 'XML|*.xml'; if OD.Execute then begin Screen.Cursor := crHourGlass; if RB1.Checked then BaseSWF := TSWFStreamReader.Create('') else { BaseSWF := TFlashMovie.Create(0, 0, 1, 1, 1)}; BaseSWF.OnProgress := onProcess; BaseSWF.LoadFromXMLFile(OD.FileName, true); BaseSWF.MakeStream; BaseSWF.SaveToFile(ChangeFileExt(OD.FileName, '_new.swf')); BaseSWF.Free; label1.Caption := ''; ProgressBar.Position := 0; ShellExecute(0, 'open', pchar(ChangeFileExt(OD.FileName, '_new.swf')), nil, nil, SW_NORMAL); Screen.Cursor := crDefault; end; end;