Creating A Text Editor in Flash With MDM Zinc
Creating A Text Editor in Flash With MDM Zinc
Creating A Text Editor in Flash With MDM Zinc
Usuario
Contrasea
Enter
o register
Buscar..
Add a tutorial
Qu quieres buscar?
What is Cristalab?
Tags
Examples
Contact Us
Anime
Search
0
Tw ittear
Many people ask in forums and save a txt with flash. Well, with the help of MDM Zinc is very easy. I tried commenting out all the lines of code. Of course you have to have installed the MDM Zinc . opened a new document in Flash and get into the scene one TextArea and 3 Buttons. We would be something like:
Code:
b o t _ a b r i r.o n R e l e a s e= f u n c t i o n( ) { m d m.D i a l o g s.B r o w s e F i l e.t i t l e= " O p e n ", //T i t l eo ft h ew i n d o w m d m.D i a l o g s.B r o w s e F i l e.b u t t o n T e x t= " O p e n ", //b u t t o nt e x t m d m.D i a l o g s.B r o w s e F i l e.f i l t e r l i s t= " D o c u m e n tT X T|* .t x t ", //O n l ys h o wu st h et x t f i l e N a m e=m d m.D i a l o g s.B r o w s e F i l e.s h o w( ) //O p e naw i n d o wt ol o c a t et h ef i l eo ny o u rh a r dd i s k i f (f i l e N a m e= = " f a l s e ") { //I fw ep r e s sC a n c e lt h e nd on o t h i n g } e l s e { //C h e c ki ff i l ee x i s t s v a rF i l e E x i s t s=m d m.F i l e S y s t e m.F i l e E x i s t s(f i l e N a m e) i f (F i l e E x i s t s= = t r u e) { //I ft h e r ei s ,o p e ni t v a re x t e n s i o n=f i l e N a m e.s u b s t r( -4) .t o L o w e r C a s e( ) i f (e x t e n s i o n= = " .t x t ") { //C h e c kt h a ti sa .t x t t e x t o _ c a r g a d o=m d m.F i l e S y s t e m.l o a d F i l e(f i l e N a m e) ; //c o n v e r tl i n eb r e a k s _ r o o t.t e x t o _ t x t.t e x t=t e x t o _ c a r g a d o.s p l i t(" \r "+" \n ") .j o i n(" \r ") ; } e l s e { //I fn o ta .t x ta l e r tu so u t . m d m.D i a l o g s.p r o m p t(" T h i si sn o tat x t ") ; } } e l s e { //I fy o uh a v en o tc h o s e naf i l e ,a n o t h e ra l e r t m d m.D i a l o g s.p r o m p t(" T h a tf i l ed o e sn o te x i s t ") ; } } } ;
www.cristalab.com/tutoriales/crear-un-editor-de-texto-en-flash-con-mdm-zinc-c37783l/
1/3
8/27/13
Save button:
Code:
b o t _ g u a r d a r.o n R e l e a s e= f u n c t i o n( ) { //F i xl i n eb r e a k s v a rs t o r e=_ r o o t.t e x t o _ t x t.t e x t.s p l i t(" \r ") .j o i n(" \r "+" \n ") ; m d m.D i a l o g s.B r o w s e F i l e.t i t l e= " S a v eA s. . . ", //w i n d o wt e x t m d m.D i a l o g s.B r o w s e F i l e.b u t t o n T e x t= " S a v e ", //b u t t o nt e x t m d m.D i a l o g s.B r o w s e F i l e.f i l t e r l i s t= " T X TD o c u m e n t|* .t x t", //O n l ys h o wu st h et x t f i l e N a m e=m d m.D i a l o g s.B r o w s e F i l e.s h o w( ) //O p e naw i n d o wt ol o c a t et h ef i l eo ny o u rh a r dd i s k i f (f i l e N a m e= = " f a l s e ") { } e l s e { //C h e c kt h ee x t e n s i o nt x t v a re x t e n s i o n=f i l e N a m e.s u b s t r( -4) .t o L o w e r C a s e( ) i f (e x t e n s i o n= = " .t x t ") { //I ft h eu s e rh a se n t e r e dac o r r e c te x t e n s i o nt ot h es a v e df i l ep r o c e e d m d m.F i l e S y s t e m.s a v e F i l e U n i c o d e(f i l e N a m e,s a v e) ; } e l s e { //I ft h eu s e rh a sN O Tw r i t i n ga ne x t e n s i o n ,w ea d di tt ot h ef o r c ea n ds a v et h ef i l e m d m.F i l e S y s t e m.s a v e F i l e U n i c o d e(f i l e N a m e+" .t x t ",s a v e) ; } } } ;
Print button:
Code:
l i n eb r e a k s m d m.A p p l i c a t i o n.p r i n t V a r(p r i n t, t r u e) ; //p r o c e e dt op r i n t i n g . } ; We now publish our application and get the.
Swf, as we will see, if you try nothing will happen, but that's because to be compiled with Zinc. opened Zinc, on the "Input File" will see an area called "Input Source "Here we choose our swf. By choosing it you will see that in "Output" by default will put the name of your SWF but with the extension. Exe and you generate in the same folder as your SWF. Finally, we will give the button "BUILD" which is in the lower right corner for you to generate the executable.
[ Example Files ]
www.cristalab.com/tutoriales/crear-un-editor-de-texto-en-flash-con-mdm-zinc-c37783l/
2/3
8/27/13
Previous 1
Previous 1
Not registered yet but want to do before publishing your comment? Register
Blog
Forums
Tutorials
Flash Tutorials
Examples. Fla
Anime
Videotutoriales
Courses
Flash Course
HTML Course
Tags
www.cristalab.com/tutoriales/crear-un-editor-de-texto-en-flash-con-mdm-zinc-c37783l/
3/3