16 | 17 | ||
---|---|---|---|
1 | package com.aquababies.website.view.book_now { | 1 | package com.aquababies.website.view.book_now { |
2 | import flash.text.TextFormat; | ||
3 | import flash.text.TextField; | ||
4 | import flash.display.Bitmap; | ||
5 | import com.aquababies.website.component.booking.bLocationTableItem; | ||
6 | import com.greensock.TweenMax; | ||
2 | import com.aquababies.website.model.assets_m; | 7 | import com.aquababies.website.model.assets_m; |
3 | import flash.display.MovieClip; | 8 | import flash.display.MovieClip; |
4 | import com.aquababies.website.bEvent; | 9 | import com.aquababies.website.bEvent; |
... | ... | ||
14 | */ | 19 | */ |
15 | public class booking_step1_v extends bView { | 20 | public class booking_step1_v extends bView { |
16 | public static const N_COURSES_MC : String = "N_COURSES_MC"; | 21 | public static const N_COURSES_MC : String = "N_COURSES_MC"; |
17 | private var sq:Sprite; | 22 | public static const N_SWF_TABLE : String = "N_SWF_TABLE"; |
23 | public static const INAME_BOOK_NOW_SUBMIT_BTN_H : String = "INAME_BOOK_NOW_SUBMIT_BTN_H"; | ||
24 | public static const N_TOTAL_FIELD : String = "N_TOTAL_FIELD"; | ||
25 | private var sq : Sprite; | ||
26 | private var coures_mc : Sprite; | ||
27 | private var swf_table : MovieClip; | ||
28 | private var submit_holder : Sprite; | ||
29 | private var total_field_h : Sprite; | ||
18 | 30 | ||
19 | public function booking_step1_v() | 31 | public function booking_step1_v() |
20 | { | 32 | { |
... | ... | ||
26 | var section_holder:Sprite = _retriveBChild('section_holder') as Sprite; | 38 | var section_holder:Sprite = _retriveBChild('section_holder') as Sprite; |
27 | var book_now_holder:Sprite = section_holder.getChildByName('book_now_holder') as Sprite; | 39 | var book_now_holder:Sprite = section_holder.getChildByName('book_now_holder') as Sprite; |
28 | 40 | ||
29 | var swf_table:MovieClip = assets_m(_mdl).return_movieclip_from_library('swf_table_mc', 'swf_table_mc'); | 41 | swf_table= assets_m(_mdl).return_movieclip_from_library('swf_table_mc', 'swf_table_mc'); |
30 | book_now_holder.addChild(swf_table); | 42 | book_now_holder.addChild(swf_table); |
31 | swf_table.x = 650; | 43 | swf_table.x = 659; |
32 | swf_table.y = 400; | 44 | swf_table.y = 400; |
33 | 45 | swf_table.name = N_SWF_TABLE; | |
34 | var coures_mc:Sprite= new Sprite(); | 46 | |
47 | coures_mc= new Sprite(); | ||
35 | coures_mc.name = N_COURSES_MC; | 48 | coures_mc.name = N_COURSES_MC; |
36 | swf_table.addChild(coures_mc); | 49 | swf_table.addChild(coures_mc); |
37 | var courses:XML = _mdl.return_xml('courses'); | 50 | var courses:Array = assets_m(_mdl).booking_mdl.return_courses_info(); |
38 | //for (var i:int = 0;i < courses.children().length();i++) { | 51 | for (var i:int = 0;i < courses.length;i++) { |
39 | for (var i:int = 0;i < 3;i++) { | 52 | var b_loc_table_item : bLocationTableItem = new bLocationTableItem(i,courses[i],_mdl); |
40 | var item:MovieClip = assets_m(_mdl).return_movieclip_from_library('swf_table_mc', 'swf_item_mc'); | 53 | coures_mc.addChild(b_loc_table_item); |
41 | coures_mc.addChild(item); | 54 | b_loc_table_item.scaleX = b_loc_table_item.scaleY = 0.97; |
42 | item.y = -30+(i*50); | 55 | b_loc_table_item.y = -30+(i*42); |
43 | item.city.selectable =false; | 56 | b_loc_table_item.x = 7; |
44 | item.details.selectable =false; | ||
45 | item.price.selectable =false; | ||
46 | item.time.selectable =false; | ||
47 | item.size.selectable =false; | ||
48 | item.date.selectable =false; | ||
49 | } | 57 | } |
50 | 58 | ||
51 | 59 | ||
60 | submit_holder = new Sprite(); | ||
61 | submit_holder.name = INAME_BOOK_NOW_SUBMIT_BTN_H; | ||
62 | var submitButtonBitmap:Bitmap = assets_m(_mdl).return_bitmap('submit_btn'); | ||
63 | submit_holder.buttonMode = true; | ||
64 | submit_holder.addChild(submitButtonBitmap); | ||
65 | submitButtonBitmap.x -=submitButtonBitmap.width/2; | ||
66 | submitButtonBitmap.y -=submitButtonBitmap.height/2; | ||
67 | submit_holder.x += submit_holder.width/2; | ||
68 | submit_holder.y += submit_holder.height/2; | ||
69 | swf_table.addChild(submit_holder); | ||
70 | |||
71 | submit_holder.scaleX = 0.64; | ||
72 | submit_holder.scaleY = 0.64; | ||
73 | |||
74 | submit_holder.alpha = 0.6; | ||
75 | |||
76 | submit_holder.x = 207; | ||
77 | submit_holder.y = 98; | ||
78 | |||
79 | /// total field | ||
80 | create_total_field(); | ||
81 | |||
52 | init_ctr(); | 82 | init_ctr(); |
53 | } | 83 | } |
84 | |||
85 | private function create_total_field() : void { | ||
86 | var _body_mc:MovieClip = _mdl.return_movieclip_from_library('website_fonts_swf', 'body_mc'); | ||
87 | |||
88 | total_field_h = new Sprite(); | ||
89 | total_field_h.name = N_TOTAL_FIELD; | ||
90 | var total_field : TextField = TextField(_body_mc.textfield); | ||
91 | total_field_h.y = 70; | ||
92 | total_field_h.x = - 201; | ||
93 | total_field.height = 30; | ||
94 | total_field.width = 390; | ||
95 | total_field_h.addChild(total_field) | ||
96 | swf_table.addChild(total_field_h); | ||
97 | } | ||
54 | 98 | ||
55 | private function init_ctr():void | 99 | private function init_ctr():void |
56 | { | 100 | { |
... | ... | ||
58 | Register_bController(new booking_step1_c()); | 102 | Register_bController(new booking_step1_c()); |
59 | } | 103 | } |
60 | public function destroy():void { | 104 | public function destroy():void { |
61 | sendBNotification(bEvent.BOOK_EVENT, { type:'section_removed' } ); | 105 | TweenMax.to(swf_table, 0.3, {alpha:0, onComplete:function() : void { |
106 | while (coures_mc.numChildren) { | ||
107 | if(coures_mc.getChildAt(0) is bLocationTableItem){ | ||
108 | bLocationTableItem(coures_mc.getChildAt(0)).destroy(); | ||
109 | } | ||
110 | coures_mc.removeChild(coures_mc.getChildAt(0)); | ||
111 | } | ||
112 | swf_table.removeChild(coures_mc); | ||
113 | swf_table.parent.removeChild(swf_table); | ||
114 | sendBNotification(bEvent.BOOK_EVENT, { type:'section_removed' } ); | ||
115 | }}) | ||
116 | submit_holder.parent.removeChild(submit_holder); | ||
117 | total_field_h.parent.removeChild(total_field_h); | ||
62 | Destroy(); | 118 | Destroy(); |
63 | } | 119 | } |
64 | } | 120 | } |