-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsocIR.mxml
76 lines (66 loc) · 2.59 KB
/
socIR.mxml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?xml version="1.0" encoding="utf-8"?>
<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
autoDrawBackground="true">
<s:layout>
<s:HorizontalLayout verticalAlign="middle" padding="10" gap="20"/>
</s:layout>
<fx:Declarations>
</fx:Declarations>
<fx:Script>
<![CDATA[
import flash.utils.setTimeout;
import mx.events.FlexEvent;
import mx.events.ItemClickEvent;
import mx.events.ListEvent;
import spark.components.List;
import spark.components.WindowedApplication;
import spark.events.IndexChangeEvent;
import spark.events.TextOperationEvent;
protected function changeSocial(event:IndexChangeEvent):void
{
data.icon = Copypaste.socialIcons.getItemAt(socialIcons.selectedIndex).icon;
icon.source = Copypaste.socialIcons.getItemAt(socialIcons.selectedIndex).path;
dataChanges();
}
private function deleteItem():void
{
del.scaleX = del.scaleY = 0.9;
setTimeout(function ():void {del.scaleX = del.scaleY = 1;}, 100);
var parentList:List = owner as List;
var e:ItemClickEvent = new ItemClickEvent(ItemClickEvent.ITEM_CLICK, true);
e.item = data;
e.index = parentList.dataProvider.getItemIndex(data);
e.label = "delete";
dispatchEvent(e);
}
protected function dataChanges():void
{
var parentList:List = owner as List;
var e:ItemClickEvent = new ItemClickEvent(ItemClickEvent.ITEM_CLICK, true);
e.label = "change";
dispatchEvent(e);
}
protected function soc_changeHandler(event:TextOperationEvent):void
{
trace ( soc.text);
data.label = soc.text;
dataChanges();
}
]]>
</fx:Script>
<s:Image id="icon" source="{'images/socialicons/' + data.icon}" />
<s:VGroup width="100%" height="100%" verticalAlign="middle" horizontalAlign="center">
<s:Label width="70%" text="Короткое обозначение соц.сети - 2-3 англ. буквы* Должно совпадать с именем вложенного проекта." textAlign="center"/>
<s:TextInput id="soc" width="30%" editable="true" text="{data.label}" change="soc_changeHandler(event)"/>
</s:VGroup>
<s:VGroup width="130%" height="100%" verticalAlign="middle">
<s:List id="socialIcons" width="130%" height="100%" dataProvider="{Copypaste.socialIcons}" change="changeSocial(event)" itemRenderer="iconIR">
<s:layout>
<s:HorizontalLayout verticalAlign="middle"/>
</s:layout>
</s:List>
</s:VGroup>
<s:Image id="del" source="images/erase.png" click="deleteItem()"/>
</s:ItemRenderer>