2011-06-09
AS3 Array size hole
Nhiều khi code ra cái lỗi không thể nghĩ đến, may mà search ra (smartfoxserver2 forum)
The length property does not really return the size of the array, but return the highest index available.
var a:Array = []
a[1000] = "Hello"
trace(a.length)
It will return a lenght of 1001, which is clearly not the size of the Array.
Labels:
ActionScript,
array size,
AS3,
Flash,
smartfoxserver2
2011-05-21
Install FlashTracer for Firefox 4, configuring Chrome with Flash Player Debugger
Disable Firefox 4 add-on compatibility
http://www.nirmaltv.com/2011/03/19/disable-add-on-compatibility-check-in-firefox-4/
Download and install Flash Tracer
http://www.sephiroth.it/firefox/flashtracer/
+ Config
SuppressDebuggerExceptionDialogs=1
Configuring Chrome with Flash Player Debugger
Với Chrome chúng ta không thể install debugger vào bản release như FF vì nó dùng update Flash player mới nhất kèm theo trong bản cài đặt ;-(.
Tắt plugins Flash bằng cái vào about:plugins thực hiện disable. Install Flash Player Debugger là xong xuôi.
http://www.nirmaltv.com/2011/03/19/disable-add-on-compatibility-check-in-firefox-4/
Download and install Flash Tracer
http://www.sephiroth.it/firefox/flashtracer/
+ Config
SuppressDebuggerExceptionDialogs=1
Configuring Chrome with Flash Player Debugger
Với Chrome chúng ta không thể install debugger vào bản release như FF vì nó dùng update Flash player mới nhất kèm theo trong bản cài đặt ;-(.
Tắt plugins Flash bằng cái vào about:plugins thực hiện disable. Install Flash Player Debugger là xong xuôi.
Labels:
about:plugins,
add-ons,
compatibility,
Firefox,
Firefox 4,
Flash Tracer
2011-04-05
Started playing with as3isolib
Mấy bữa nay mình tập tành Flash rồi coi những thứ liên quan tới isometric game. Hy vọng là sẽ có thể hiểu biết thêm 1 chút gì đó. Làm những gì liên quan đến game có cảm giác thú vị. Isometric game thì là loại mình đã chơi từ hồi bé, trừ mấy năm gần đây không chơi nữa chắc cũng được 20 năm. Có điều mình không có khiếu mỹ thuật nên nhiều cái chẳng làm được, 1 phần search trên net một phần nhờ người này người khác làm giùm.
Search qua 1 vòng thì mình chọn as3isolib. Để tìm hiểu thêm 1 chút nữa. Một engine khác là OpenSpace cũng nổi tiếng nhưng khá là mắc 2200 EUR nhưng đúng là engine đó tổ chức tốt mình đã học nhiều thứ trên website của nó http://www.openspace-engine.com/.
Gambatte ...
Search qua 1 vòng thì mình chọn as3isolib. Để tìm hiểu thêm 1 chút nữa. Một engine khác là OpenSpace cũng nổi tiếng nhưng khá là mắc 2200 EUR nhưng đúng là engine đó tổ chức tốt mình đã học nhiều thứ trên website của nó http://www.openspace-engine.com/.
Gambatte ...
2011-03-21
Beginning Flash and ActionScript: FlashBuilder 4 setting colors scheme, code formatter
Trước khi bắt đầu coding gì đó PL đều thực hiện chỉnh lại IDE, chọn màu dark cho dịu mắt, vừa làm được ban ngày lẫn ban đêm.
Chỉnh colors schema của IDE.
Có thể dùng theme pluggin - http://eclipse-color-theme.github.com/update
Đầu tiên chọn colors schema của Eclipse trước có thể ghé qua trang http://www.eclipsecolorthemes.org/?list=toppicks&filter=dark
Mình chọn Obsidian trước sau đó sẽ thay 1 số thứ như selection background, download Obsidian.epf về, nhưng mới chỉ là chọn colors schema cho Eclipse, sau khi chỉnh Eclipse colors schema thì cần chỉnh editor của ActionScript nữa. Nói chung toàn bộ colors chỉnh như sau.
Chỉnh thêm Text Editors > Annotations > ActionScript Occurrences là Text as Highlighted 47, 57, 87
Bây giờ cần chỉnh thêm ActionScript colors schema
Selection
For a complete list of available keyboard shortcuts, see Accessing keyboard shortcuts. For information about editing existing or creating new keyboard shortcuts, see Changing keyboard shortcuts.
Chỉnh colors schema của IDE.
Có thể dùng theme pluggin - http://eclipse-color-theme.github.com/update
Đầu tiên chọn colors schema của Eclipse trước có thể ghé qua trang http://www.eclipsecolorthemes.org/?list=toppicks&filter=dark
Mình chọn Obsidian trước sau đó sẽ thay 1 số thứ như selection background, download Obsidian.epf về, nhưng mới chỉ là chọn colors schema cho Eclipse, sau khi chỉnh Eclipse colors schema thì cần chỉnh editor của ActionScript nữa. Nói chung toàn bộ colors chỉnh như sau.
Window > Preferences > General > Editors > Text Editors >
Line number foreground: 129, 150, 154
Current line highlight: 47, 57, 60
Print margin: 129, 150, 154
Find Scope: 224, 226, 228
Selection foreground color: 224, 226, 228
Selection background color: 85, 87, 83
Background color: 41, 49, 52
Foreground color: 221, 227, 230
Hyperlink: 25, 74, 165
Chỉnh thêm Text Editors > Annotations > ActionScript Occurrences là Text as Highlighted 47, 57, 87
Bây giờ cần chỉnh thêm ActionScript colors schema
Window > Preferences > Flash Builder > Editors > Syntax Coloring > ActionScript >
ASDoc: #7d8c93
Bracket/Brace: #11a37c
Comment: #7f7e7e
Default text: #c9c9c9
Keyword: class: #5fa0c1
Keyword: functio #5fa0c1
Keyword: interface: #5fa0c1
Keyword: package: #5fa0c1
Keyword: trace: #76b0c3
Keyword: var: #11a37c
Metadata: #11a37c
Operator: #11a37c
Reserved: #5fa0c1
String: #96cee1
Flash Builder > Editors > Syntax Coloring > MXML >
ASDoc: #7d8c93
Comment: #7f7e7e
Component Tag: #2b91af
Default Text: #c9c9c9
Processing Instruction: #11a37c
Special Tag: #5fa0c1
String: #11a37c
Còn lại một phần nữa là CSS, tùy mỗi người thích sao thì chọn tiếp.
Kết quả như sau:
Default, current line, occurrences
Selection
Download formatter
Dùng source Flex Formatter - http://flexformatter.googlecode.com/svn/trunk/FlexFormatter/FlexPrettyPrintCommandUpdateSite hoặc download formatter từ http://sourceforge.net/projects/flexformatter/ bỏ vào pluggins folder.
OK đến đây có vẻ ổn ổn rồi. Còn lại là một vài shortcut và chỉnh lại ASDoc template.
For a complete list of available keyboard shortcuts, see Accessing keyboard shortcuts. For information about editing existing or creating new keyboard shortcuts, see Changing keyboard shortcuts.
| Name | Keyboard shortcut | Description |
|---|---|---|
| Switch between Source and Design mode | Control+`(Left Quote) | Switches between the MXML editor’s Source and Design modes. |
| Go to Documentation (Flash Builder plug-in) Find in API Reference (Flash Builder stand-alone) | Shift+F2 | When you edit MXML or ActionScript, selecting a language element and pressing Shift+F2 displays language reference Help for the selected element. For more information, see Getting help while writing code. |
| Context-sensitive Help | F1 (Windows) Command+Shift+/ (Mac OS) | Displays context-sensitive Help for the currently selected workbench element (editor, view, dialog box, and so on). |
| Add Block Comment | Control+Shift+C (Windows) Command+Shift+C (Mac OS) | Adds block comment formatting to the currently selected lines of code or adds a comment at the insertion point. For more information, see Adding comments and comment blocks. |
| Add CDATA | Control+Shift+D (Windows) Command+Shift+D (Mac OS) | Adds a CDATA statement at the insertion point so that you can add ActionScript to an MXML document. |
| Find Matching Bracket | Control+Shift+P (Windows) Command+Shift+P (Mac OS) | Moves the cursor to the matching bracket of the selected code statement. |
| Content Assist | Control+Space (Windows) Command+Shift+Space (Mac OS) | Displays code hinting. For more information, see Using Content Assist. |
| Find All Declarations in Workspace | Control+G (Windows) Command+G (Mac OS) | Finds declarations in your code base. See Finding references and refactoring code. |
| Find All References in Workspace | Control+Shift+G (Windows) Command+Shift+G (Mac OS) | Finds references to identifiers in your code base. See Finding references and refactoring code |
| Go to Definition | F3 | Open the source of an external code definition. For more information, see Opening code definitions. |
| Go to Line | Control+L (Windows) Command+L (Mac OS) | Displays the Go to Line dialog box where you can enter a line number and navigate to it in the editor. |
| Last Edit Location | Control+Q (Windows) Control+Q (Mac OS) | Highlights the last edited line of code. |
| Mark Occurrences | n/a | Marks every occurrence of the selected item in code. |
| Organize Imports | Control+Shift+O (Windows) Command+Shift+O (Mac OS) | When editing ActionScript, using this keyboard shortcut alphabetizes any import statements contained in the document. For more information, see Organizing import statements. |
| Open Type | Control+Shift+T (Windows) Command+Shift+T (Mac OS) | Quickly browse all class types. For more information, see Browsing and viewing classes. |
| Open Resource | Control+Shift+R (Windows) Command+Shift+R (Mac OS) | Displays the Open Resource dialog box where you can quickly search for and open a resource in the editor. |
| Quick Outline | Control+O (Windows and Mac OS) | Displays the Outline view in Quick mode in the editor. For more information, see Using Quick Outline view in the editor. |
| Toggle Comment | Control+/ (Windows) Command+/ (Mac OS) | Toggles ActionScript comments in ActionScript code. See Adding comments and comment blocks. |
| Toggle BlockComment | Shift+Control+C Shift+Command+C | Toggle MXML comment blocks. See Adding comments and comment blocks. |
| Toggle Folding | Control+Numpad_divide | Toggles the folding of code blocks. See Setting, folding, and unfolding code blocks. |
Labels:
ActionScript,
code formatter,
Eclipse,
Flash,
FlashBuilder 4,
Flex,
Obsidian,
shortcuts
2011-03-08
How to disable Flash Debugger Error Messages in Firefox
Develop với Flash và install Debugger Player lâu lâu bị dialog báo lỗi, mà modal dialog nên không thể làm gì nếu không tắt nó, rất là bực mình. Vẫn biết là sẽ chỉnh được trong mm.cfg nhưng không biết là param gì. Cuối cùng search trên net cũng có.
Thêm vào file mm.cfg trong user folder, với Windows 7 thường là C:\Users\{user-name}\mm.cfg
SuppressDebuggerExceptionDialogs=1
http://perezj.blogspot.com/2010/08/how-to-disable-flash-debugger-error.html
http://www.senocular.com/?entry=475
http://yoavgivati.com/2009/09/disable-flash-debugger-error-messages/
Thêm vào file mm.cfg trong user folder, với Windows 7 thường là C:\Users\{user-name}\mm.cfg
SuppressDebuggerExceptionDialogs=1
http://perezj.blogspot.com/2010/08/how-to-disable-flash-debugger-error.html
http://www.senocular.com/?entry=475
http://yoavgivati.com/2009/09/disable-flash-debugger-error-messages/
2011-02-24
Is there an Assembly.Unload method?
Is there an Assembly.Unload method?
Bạn develop bằng .NET, đã làm một số các ứng dụng. Đã có khi bạn đặt câu hỏi: có hay không method cho phép unload một assembly đã loaded, hay nói cho đơn giản bạn muốn replace một dll, nhưng dll này đang sử dụng bởi chính ứng dụng muốn replace, vì thế sẽ không overwrite được ... Có nhiều mục đích cần đạt được như thay thế version mới, cập nhật config file ... sẽ dẫn đến câu hỏi này.
Mình đã từng gặp chuyện này khi đụng đến việc apply config file. Câu trả lời là không. Nhưng tại sao trong khi với unmanaged code có thể LoadLibrary rồi FreeLibrary? Bữa nay có người hỏi nên nhắc lại. Có rất nhiều article trên net viết về vấn đề này.
Trên Stackoverflow
http://stackoverflow.com/questions/123391/how-to-unload-an-assembly-from-the-primary-appdomain
Jason Zander's WebLog
http://blogs.msdn.com/b/jasonz/archive/2004/05/31/145105.aspx
Suzanne Cook's blog
http://blogs.msdn.com/b/suzcook/archive/2003/07/08/57211.aspx
Như vậy cách giải quyết như thế nào. Câu trả lời là hãy design ứng dụng dựa vào app domain, việc unload với app domain được hỗ trợ fully.
1. Tạo app domain
2. Load assembly cần sự dụng
3. Thực hiện something với assembly
4. Unload app domain
Về code thì chịu khó search với Google.
Tất nhiên là lý thuyết nó như vậy, nhưng thực tế thì mình cũng chưa bao giờ phải design cái gì như thế và cũng không thích là gì xiên xẹo với app domain.
Nice developing,
Bạn develop bằng .NET, đã làm một số các ứng dụng. Đã có khi bạn đặt câu hỏi: có hay không method cho phép unload một assembly đã loaded, hay nói cho đơn giản bạn muốn replace một dll, nhưng dll này đang sử dụng bởi chính ứng dụng muốn replace, vì thế sẽ không overwrite được ... Có nhiều mục đích cần đạt được như thay thế version mới, cập nhật config file ... sẽ dẫn đến câu hỏi này.
Mình đã từng gặp chuyện này khi đụng đến việc apply config file. Câu trả lời là không. Nhưng tại sao trong khi với unmanaged code có thể LoadLibrary rồi FreeLibrary? Bữa nay có người hỏi nên nhắc lại. Có rất nhiều article trên net viết về vấn đề này.
Trên Stackoverflow
http://stackoverflow.com/questions/123391/how-to-unload-an-assembly-from-the-primary-appdomain
Jason Zander's WebLog
http://blogs.msdn.com/b/jasonz/archive/2004/05/31/145105.aspx
Suzanne Cook's blog
http://blogs.msdn.com/b/suzcook/archive/2003/07/08/57211.aspx
Như vậy cách giải quyết như thế nào. Câu trả lời là hãy design ứng dụng dựa vào app domain, việc unload với app domain được hỗ trợ fully.
1. Tạo app domain
2. Load assembly cần sự dụng
3. Thực hiện something với assembly
4. Unload app domain
Về code thì chịu khó search với Google.
Tất nhiên là lý thuyết nó như vậy, nhưng thực tế thì mình cũng chưa bao giờ phải design cái gì như thế và cũng không thích là gì xiên xẹo với app domain.
Nice developing,
2010-12-26
How to downgrade from Firefox 3.6
Hôm nay thì thực sự là bực mình với thằng FF rồi, và vừa chuyển sang dùng Google Chrome với Safari thì mình sẽ downgrade nó xuống. Chẳng hạn chuyển xuống 3.5 hay 2.0 cũng được. Chỉ cần download version cũ về và install thì FF sẽ tự động downgrade.
+ Tất cả các release có thể tìm tại FTP server của FF chỉ cần chọn win32 (hay OS nào tương ứng) chọn ngôn ngữ tiếng Anh EN-GB.
+ Chọn version stable 3.5.7
+ Hoặc chọn 3.5.16 tại đây FF 3.5 old version
Install lại FireBug cho 3.5 https://addons.mozilla.org/en-US/firefox/addon/1843/versions/
+ Tất cả các release có thể tìm tại FTP server của FF chỉ cần chọn win32 (hay OS nào tương ứng) chọn ngôn ngữ tiếng Anh EN-GB.
+ Chọn version stable 3.5.7
+ Hoặc chọn 3.5.16 tại đây FF 3.5 old version
Install lại FireBug cho 3.5 https://addons.mozilla.org/en-US/firefox/addon/1843/versions/
Subscribe to:
Comments (Atom)

