Home Php C# Sql C C++ Javascript Python Java Go Android Git Linux Asp.net Django .net Node.js Ios Xcode Cocoa Iphone Mysql Tomcat Mongodb Bash Objective-c Scala Visual-studio Apache Elasticsearch Jar Eclipse Jquery Ruby-on-rails Ruby Rubygems Android-studio Spring Lua Sqlite Emacs Ubuntu Perl Docker Swift Amazon-web-services Svn Html Ajax Xml Java-ee Maven Intellij-idea Rvm Macos Unix Css Ipad Postgresql Css3 Json Windows-server Vue.js Typescript Oracle Hibernate Internet-explorer Github Tensorflow Laravel Symfony Redis Html5 Google-app-engine Nginx Firefox Sqlalchemy Lucene Erlang Flask Vim Solr Webview Facebook Zend-framework Virtualenv Nosql Ide Twitter Safari Flutter Bundle Phonegap Centos Sphinx Actionscript Tornado Register | Login | Edit Tags | New Questions | 繁体 | 简体


10 questions online user: 50

8
votes
answers
25 views
+10

flexunit with pure ActionScript project in Flex Builder 3

If you create a pure ActionScript project in Flex Builder 3 and want to do unit testing using flexunit, what is the best option?

The built-in Flex builder will refuse to build the mxml file containing the TestRunnerBase component as it is a pure ActionScript project (no Flex allowed). It is impossible to add the mxml file to the "ActionScript Applications" list in the project settings.

Right now I can see two options, both undesirable.

  1. Add the unit testing mxml file to the project and create an external tool setup to build and run it. This is the approach I'm taking now, and it works fine, except that interactive debugging is impossible.
  2. Create a new Flex project just for the test mxml file and add the main project's src directory as an additional source directory in the build options. I don't like this approach because it requires that I keep the mxml file in a separate directory tree from all the other source files in addition to the ugliness of maintaining two projects.
沙发
+30
+50

總是 ASUnit

+10

我最終將單元測試mxml文件放在原始項目中,創建一個新的Flex項目,刪除src目錄,並將其替換為Eclipse鏈接文件夾到ActionScript項目的src目錄。這個設置似乎工作正常。

+10

為了讓FlexUnit與CruiseControl.net(持續集成服務器)一起工作,我們做了類似的事情。

在我們的實現中,我們在下面的代碼中運行FlexEvent.CREATION_COMPLETE處理程序。應用程序類。

如何輸出單元測試的結果完全取決於您。我們的實現已經與AIR和Zinc3一起使用,並且都輸出了一個NUnit友好的XML表示,然後退出應用程序(如果任何測試失敗,退出代碼為-1)。

  // import mx.core.Application; // import flexunit.framework。*; //類AutomatedTestHarness extends Application實現TestListener私有函數creationCompleteHandler(event:Event):void {th??is._result = new TestResult(); this._result.addListener(本); var testSuite:TestSuite = new TestSuite(); this.addUnitTests(測試包); testSuite.runWithResult(_result); } / ** *將它們作為TestResult.addListener的一部分實現*如果要在測試運行後輸出xml,請在此處執行*(提示:在endTest中計算測試並將計數與testSuite.countTestCases()*進行比較以查找當所有測試都完成時)* / function startTest(test:Test):void {} function endTest(test:Test):void {} function addError(test:Test,error:Error):void {} function addFailure(test:測試,錯誤:AssertionFailedError):void {}  
     
			
        
+10

也許您可以使用flexunit.textui.TestRunner,它將結果輸出到控制台。

+10

我們已經將我們想要測試的所有代碼考慮到庫項目中。然後我們為測試提供了一個單獨的項目,這是一個flex項目,它取決於被測項目。

聽起來它也會起作用,但到目前為止,我的鏈接文件夾設置沒有任何問題。 - Tmdean 2009年1月7日14:52

+10

嘗試從libspark AS3Unit 他們還有一個異步beta測試工具包。

好的......這兩個(ryan / drawcoder)非常可疑; 請不要在重複的帳戶下發布。 - Marc Gravell•2009年6月4日15:13

0

從libspark嘗試AS3Unit。他們還有一個異步beta測試工具包。

好的......這兩個(ryan / drawcoder)非常可疑; 請不要在重複的帳戶下發布。 - Marc Gravell•2009年6月4日15:13

嘗試:跟踪(String.fromCharCode(Keyboard.D)),但在UP的情況下它是無用的 - 切爾諾夫2013年11月2日在6:34

這真的很有用,謝謝。但是我有什麼辦法可以獲得UP或SHIFT等鍵嗎? - Liam Flaherty 2013年11月2日6:41

0

刪除項目的.actionScriptProperties文件中的'excludedEntries'元素應該可行,我用這種方式在我的純actionscript項目中構建mxml文件。

謝謝,這完美無缺 - Liam Flaherty於2013年11月2日11:50

輝煌。我被這段代碼迷住了。謝謝你!我知道這是5年前,但仍然。 - 尼爾戴維斯2017年2月25日8:56

0

您可以查看我們如何使用FlexUnit4 設置Robotlegs的構建和他們的CI ant任務。

對於版本控制,我們刪除所有Flex / Flash Builder項目文件。src和test文件夾都設置為src路徑。通過螞蟻構建進行測試。或者,如果您是視覺測試跑步者,可以設置第二個帶跑步者的項目。

它非常有效且易於在許多貢獻者中使用。

8
votes
answers
45 views
+10

how do I use the “in” operator? Flex/AS3

So the documentation has this nifty "in" operator which I like the idea of more that using a multiple step or statement (||). The documentation gives me this example.

trace("PI" in Math);         // true
trace("myProperty" in Math); // false

and

public var myArray:Array = ["zero", "one", "two"];
trace(0 in myArray); // true
trace(1 in myArray); // true
trace("two" in myArray); // true
trace(3 in myArray); // false

So I try to use it like this:

var quickArray:Array = ["@icd9_color","@icd9_icd9","@templateIcd9_name","@templateIcd9_name","@templateIcd9_templateIcd9ID"];
return (element.dataField in quickArray);

Now I can trace or Alert.show() the element.datafield and it will match exactly with an array item, but it never returns true. Can anyone help me figure out why?

The only thing I can get to work this ugly thing:

return (
  element.dataField == "@icd9_color" ||
  element.dataField == "@icd9_icd9"
  etc..
)
沙发
+80
+50

運算符中的檢查對像是否具有指定的屬性 - 該屬性的值是什麼。

您想要使用< code> Array.indexOf 並檢查非負值。

謝謝我因此而變得非常惱火。 - invertedSpear 09年12月11日18:53

所以不應該追踪(myArray中的“兩個”); 在invertSpear的測試中輸出false而不是true? - bug-a-lot 2010年2月2日15:28

6
votes
answers
26 views
+10

Getting swf boolean parameters

I have a swf that I call as

/SWFUploader/upload.swf?single=true

Then in ActionScript 3 I read in the value. But it's not working. Here's my test code (the first block is taken from http://blogs.adobe.com/pdehaan/2006/07/using_flashvars_with_actionscr.html ):

var keyStr:String;
var valueStr:String;
var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
for (keyStr in paramObj) {
    valueStr = String(paramObj[keyStr]);
    trace(keyStr + " = " + valueStr);
}

var isSingle:Boolean = this.loaderInfo.parameters.single as Boolean;
var isSingle1:Boolean = this.loaderInfo.parameters['single'] as Boolean;
var isSingle2:Boolean = LoaderInfo(this.root.loaderInfo).parameters['single'] as Boolean;
var isSingle3:Boolean = LoaderInfo(this.root.loaderInfo).parameters.single as Boolean;
trace(isSingle + ", " + isSingle1 + ", " + isSingle2 + ", " + isSingle3);

And frustratingly this is the resulting two lines that are traced:

single = true
false, false, false, false

What am I doing wrong?

沙发
+60
+50

在ActionScript中不為空且不為null將字符串轉換為Boolean true

  var singleStr:String = this.loaderInfo.parameters.single; var singleBool:Boolean = singleStr ==“true”;  
     
			
        

第二行並不是真正的演員陣容,但是它很有效。謝謝。 - dumbledad 12年1月26日11:52

4
votes
answers
25 views
+10

Actionscript 3 and navigateToUrl Method

I have a flash file with some buttons to open web addresses and I have made XML file to store my URL and then read them and parse them and assign the buttons functions to open URL:

btnRadio.addEventListener(MouseEvent.CLICK,
function()
{
    navigateToURL (radiourl , "_blank");
});

This code is working perfectly in flash player while development but when I publish it it does not work can anyone tell me what is the problem now?

沙发
+40
+50

Ctrl + Enter運行使用Flash播放器投影儀。當您發佈到瀏覽器時,它只是在html中包含該swf並在瀏覽器中顯示它。請注意,Flash Player安全策略以下列方式限制您:

  • navigateToUrl和其他http通信功能可能只在您從 http / https (除非您添加例外,不建議從安全角度來看)因此,在瀏覽器中打開html文件(在 file 域中執行此操作)將違反安全約束,並且不允許使用navigateToUrl

唯一的部分不是真的我害怕,簡單地設置你的本地驅動器作為例外,看到我的答案 - 克里斯11年11月15日在8:18

修正了答案...本來是想寫一下,我的想法,謝謝。 - Pranav Hosangadi 2011年11月15日8:57

我不明白從開發驅動器中打開它是多麼危險 - 你應該只在本地運行自己的swf / htmls。 - 克里斯11月15日上午9點

賓果......有效的話語是你自己的。如果有人給了你一個瑞士法郎,你把它保存在你的C盤上並運行它,結果是流氓,那麼你就被卡住了:) Macromedia把這個限制放在了一個原因:) - Pranav Hosangadi 2011年11月15日在9:02

老實說,老實說,我不認為我會運行其他人的SWF。設置一個wamp似乎有點矯枉過正 - 克里斯11月15日在9:38

8
votes
answers
40 views
+10

Datagrids on Flex Mobile

Adobe tells us to not use Datagrid on mobile devices. I'm creating a Blackberry Playbook application that has more screen space to potentially display a table of data. So a few questions arise!

  • If I shouldn't use DataGrid, what should I use? (List doesn't count because in my application I have 10's of tables each with different numbers of columns and column widths)

  • Ok, if I have to use a Datagrid, how can I set the size of it to show exactly all the data? For example, some tables have rows of different lengths, so requestedRowCount='-1' doesn't seem to work (See example below)

The Code

    <s:DataGrid  requestedRowCount="-1" requestedColumnCount="-1" variableRowHeight="true"  styleName="dataGrid" id="partiesGrid" dataProvider="{arr1}"  skinClass="skins.DataGridSkin" click="navigator.pushView(view.AssessmentInvolvementEditView)">
        <s:columns>
        <s:ArrayList>
            <s:GridColumn dataField="name" headerText="Name" width="150"/>
            <s:GridColumn dataField="role" headerText="Role" width="150"/>
            <s:GridColumn dataField="startdate" headerText="Start" width="100"/>
            <s:GridColumn dataField="enddate" headerText="End" width="100"/>
            <s:GridColumn dataField="presponsibility" headerText="Response" width="150"/>
            <s:GridColumn dataField="pcarer" headerText="Carer" width="110"/>
            <s:GridColumn dataField="kworker" headerText="Worker" width="110"/>
            <s:GridColumn dataField="kteam" headerText="Team" width="110"/>
        </s:ArrayList>
        </s:columns>
    </s:DataGrid>`

The Result (Notice how the height doesnt fit the 3 rows, it adds space at the bottom)!enter image description here

沙发
+80

讓datagrid只顯示添加的數據並非不可能,但這不是我要做的,特別是對於移動應用程序。

就個人而言,我會使用一個DataGroup(使用virtualLayout = true)包裝在Scroller中設置為高度/寬度100%(這只會在數據“溢出”時顯示)。DataGroups默認設置顯示所有數據。您必須為數據創建自己的項目渲染器,並可以創建自己的“標題”。

通過這樣做,您將從網格中刪除大量功能,但它在移動應用程序中很少使用。此外,如果您創建數據組,您可以添加自己的觸摸功能和手勢來做事情,同時保持網格的“權重”低,以提供良好的用戶體驗。

板凳
0

使用width =“100%”和height =“100%”

0
votes
answers
34 views
+10

Difference between Flash, Air, and ActionScript

can someone describe these 3 technologies, the differences between the, and how they relate to each other?

8
votes
answers
25 views
+10

Very custom / horizontal tree view in Flex

I am not sure if it possible or what would be the best way to archive the following in Adobe Flex 4 (I am also fine with Flex 3).

I need some kind of a tree view, but the items should be placed like a tree from top to down and not like it is done in the treeview implementation of the Flex framework. To make it more clear here an simple "graphic":

            1
    ------------------
    2                3
--------        ----------
4      5        6        7

Is it possible to skin the Flex tree view to look like my example? If not, how create a custom component that is usable like a native Flex component (attach handlers to every node, make it skinnable) and creates structures like above.

沙发
+60
+50
+20

對於mx來說這太過分了:樹就像那樣彎曲。設計你自己的控制,獲得很多經驗。想一想你想要如何佈局節點,如何繪製分支。如果您可以將所有元素都放入矩形網格中,那麼很容易管理:

  root | | + | -------------- |  -  | | | 分支分支  

決定是否需要可折疊分支,垂直線。將它全部劃分為簡單元素,並基於UIComponents實現每個元素。 graphics 上繪製線條,在某些方框中從標籤組成分支。

有時候製作自己的控件會更好更乾淨。我用一天的虛擬物品製作了平滑滾動列表。在那之前,

7
votes
answers
27 views
+10

Event Metadata: Using static variable for “name” attribute?

I want to use the Event metadata tags to show what types of event my control will dispatch. The syntax looks like:

<fx:Metadata>
    [Event(name="eventName", type="MyEvent")]
</fx:Metadata>

It seems like a best practice in Flex/Actionscript to define static variables that define event names like so:

public class MyEvent extends Event
{
    public static const EVENT_NAME:String = "eventName";
    // Other stuff..
}

It's a great practice since the event name can change easily and not have to be modified throughout the code. So my question is: Is there any way to use this static const in my metadata event tag? I can't seem to do something like this:

<fx:Metadata>
    [Event(name="{MyEvent.EVENT_NAME}", type="MyEvent")]
</fx:Metadata>

Am I just ignorant of the proper syntax to do this, or is it impossible? Seems like it's just asking for hard to find bugs if someone decides to change the const since it is not strongly typed here. Thanks in advance!

沙发
+60
+50

壞消息是不可能的:(我夢見這種可能性,但......

+10

是的,這是不可能的,但沒有什麼能阻止你做自己的運行時檢查。通過調用describeType()類(在本例中)可以獲得元數據解析xml並根據您的consts檢查值。如果有問題,拋出錯誤或輸出跟踪。它並不完美,但它會給你一些安全感

7
votes
answers
33 views
+10

existing swf mp4 player? [closed]

I have a mp4 file put in my website, say http://example.com/a.mp4, I want a swf player that can be embedded into my html, and play the mp4 file. I don't know how to write actionscript so I just want to have an existing swf file.

Requirement: small, fancy, full function, ad free.

Thanks.

沙发
+10
+50
+60

我最近在尋找一個簡單,強大,可用,非品牌的swf視頻播放器,在使用HTML5 &lt; video&gt; 元素時用作閃存後備,我發現 Strobe Media Playback 播放器。它滿足了所有這些要求,功能相當豐富。這些文件可以從他們的 Sourceforge目錄直接下載。這里或多或少是我如何使用它:

 &lt; video controls poster =“video.jpg”&gt; &lt; source src =“video.mp4”type =“video / mp4”&gt; &lt; source src =“video.webm”type =“video / webm”&gt; &lt; object type =“application / x-shockwave-flash”data =“StrobeMediaPlayback.swf”&gt; &lt; param name =“movie”value =“StrobeMediaPlayback.swf”&gt; &lt; param name =“flashvars”value =“src = video.mp4&amp; amp; poster = video.jpg”&gt; &lt; img src =“video.jpg”alt =“視頻”&gt; &lt; p&gt;您的瀏覽器無法播放HTML5或Flash視頻。&lt; a href =“video.mp4”&gt;下載&lt; / a&gt; 。代替&LT; / p為H. &LT; /對象&gt; &LT; /視頻&GT;   

它支持 flashvars 參數中可指定的許多參數,

0
votes
answers
30 views
+10

JWPlayer: Trying to bound the video player inside my own container

I am using the JWPlayer source code for 6.0.2813 (http://developer.longtailvideo.com/trac/) and It seems the even though I have a movieclip and I added the jwplayer class as a child, the jwplayer creates itself as a child of the main stage, thus allowing it to expand to the bound of the stage and not my movieclip (which I want to be a resizeable/draggable container) in my flash.

I asked the forums for help but they said they never intended it this way and wasn't much help. I was hoping someone familar with the source code could point my in the right direction.

How can I get the JWPlayer to be contained to a movieclip?

Edit:

I made a little bit of progress.

I found the RootReference class in com/longtailvideo/jwplayer/utils/RootReference.as

        public function RootReference(displayObj:DisplayObject) {
            if (!RootReference.root) {
                RootReference.root = displayObj.root;
                RootReference.stage = displayObj.stage;
                try {
                    Security.allowDomain("*");
                } catch(e:Error) {
                    // This may not work in the AIR testing suite
                }
            }
        }

And noticed that the RootReference.stage is where things get added as a child. RootReference.stage = displayObj.stage; where the player class object is sent as displayObj I changed it to be RootReference.stage = MovieClip(root).gui.video_container;

Then throughout the code RootReference.stage.stageHeight and RootReference.stage.stageWidth was used so I switched it to RootReference.stage.height and RootReference.stage.width. This got it to compile and now the video is within the container but the video's top left is center on my video_container's center and the video isn't resized to the size of my container, but rather the size of the video. Also the controls are completely messed up.

But I was able to resize and move the video around