Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   Flash Приложения: AIR, Zinc и тд. (http://www.flasher.ru/forum/forumdisplay.php?f=94)
-   -   Не подключается xml в air (http://www.flasher.ru/forum/showthread.php?t=198068)

Flinch 18.04.2013 20:52

Не подключается xml в air
 
пишу приложение AIR в FB 4.6, в котором есть datagrid с подключенным xml файлом .Суть в том , что при в FB xml файл привязан и все работает,а после сборки(экспорта) и установки приложения air , xml файл не подключается.Подскажите нубу че делать? .В FB так

<fx:XML id="XML" xmlns="" format="e4x" source="NewFile.xml" />
Или это возможно настройках где-то проекта?или при экспорте?

caseyryan 18.04.2013 22:34

Самое первое что пришло в голову, путь к файлу не верный. При компиляции в ide файл может браться из папки bin, но в собраном проекте относительные пути уже такими не будут. Советую добавить слушатель IOErrorEvent.IO_ERROR и посмотреть что будет в обработчике. Или положить файл в то место, которое точно есть на компе, например C:\NewFile.xml и прописать в прогу полный путь до него. Чисто для проверки, чтобы убедиться в этом дело или нет

Flinch 19.04.2013 00:38

Точный путь не помогает((.Подробный код .
Код AS3:

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                                          xmlns:s="library://ns.adobe.com/flex/spark"
                                          xmlns:mx="library://ns.adobe.com/flex/mx">
 
        <fx:Script>
                <![CDATA[
                        var a:int=0;
                        protected function button1_clickHandler(event:MouseEvent):void
                        {
 
 
                                        var treb1:Object= new Object();
                                        treb1.df_id=L_ID.text;
                                        treb1.df_name=L_Name.text;
                                        treb1.df_mark=L_Mark.text;
 
 
                                        if (spisokXML.ychenik[0] == null )
                                        {
                                                a=0;
                                        }
                                        else
                                        {
                                                a=spisokXML.children().length()-1
                                                a=a+1;
                                        }
                                        spisokXML.appendChild(<ychenik ID=" "> </ychenik>);
                                        spisokXML.ychenik[a].@ID=a;
                                        spisokXML.ychenik[a].df_id=treb1.df_id;
                                        spisokXML.ychenik[a].df_name=treb1.df_name;
                                        spisokXML.ychenik[a].df_mark=treb1.df_mark;
 
                                        DataG.dataProvider=spisokXML.ychenik;
                                        a++
 
                                }
 
                        protected function button2_clickHandler(event:MouseEvent):void
                        {
                                // TODO Auto-generated method stub
                                var fr:FileReference = new FileReference();
                                fr.save( spisokXML, 'spisok.xml')
                        }
 
                ]]>
        </fx:Script>
 
        <fx:Declarations>
                <!-- Разместить невизуальные элементы (например, службы или объекты значений) -->
                <fx:XML id="spisokXML" xmlns=""  format="e4x" source="spisok.xml" />
        </fx:Declarations>
        <mx:DataGrid id="DataG"  x="91" y="191" width="515" height="207"
                                dataProvider="{spisokXML.ychenik}" editable="true">
                <mx:columns>
 
                        <mx:DataGridColumn editable="true" dataField="df_id" headerText="Id" />
                        <mx:DataGridColumn editable="true" dataField="df_name" headerText="Name"/>
                        <mx:DataGridColumn editable="true" dataField="df_mark" headerText="Mark"/>
 
                </mx:columns>
 
        </mx:DataGrid>
        <s:Button  x="223" y="471" label="add" click="button1_clickHandler(event)"/>
        <s:TextInput id="L_ID" x="165" y="42"/>
        <s:TextInput id="L_Name" x="165" y="77"/>
        <s:TextInput id="L_Mark" x="165" y="119"/>
        <s:Button x="435" y="470" label="save" click="button2_clickHandler(event)"/>
 
</s:WindowedApplication>



Часовой пояс GMT +4, время: 07:41.

Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.