![]() |
|
||||||||||
|
|||||
|
Регистрация: Dec 2009
Сообщений: 45
|
import mx.core.mx_internal; use namespace mx_internal; mx_internal var _isEnabled:Boolean; mx_internal function get isEnabled():Boolean { return _isEnabled; } override mx_internal function get realtime():Boolean { return false; } private var alrt:Alert; alrt.mx_internal::alertForm.mx_internal::textField.selectable = false; ?Traditionally in OOO languages access specifiers are used to control visibility of declarations (public, private, protected). Now with XML based languages like MXML making debut, a new mechanism for controlling visibility of declarations has evolved: using namespaces. Namespaces are essentially custom access specifiers, which can have names of your choosing. Namespaces are outfitted with a Universal Resource Identifier (URI) to avoid collisions, and are also used to represent XML namespaces when working with E4X. A lot of variables in Flex are mx_internal variables and are available to the developers if they use the mx_internal namespace. Since Flex is Open Source and comes bundled with the source code.. one can easlily locate these variables in the source. For example, under the class defenition of VideoDisplay.as, you can see the an mx_internal variable called videoPlayer (of type VideoPlayer, which in turn extends from flash.media.Video) Кто хочет похвастаться интересным кодом c использованием mx_internal всех прошу сюда? ![]() |
|
|||||
|
Регистрация: Dec 2009
Адрес: Москва
Сообщений: 16
|
Ну пространство имен наподобие сишного.
|
|
|||||
|
Регистрация: Dec 2009
Сообщений: 45
|
В с++ есть friend это что-то вроде того но не то!
|
|
|||||
|
Регистрация: Dec 2009
Адрес: Москва
Сообщений: 16
|
С с++ есть нэймспейсы. std::cout, к примеру. Если не подключить uses namespace std. Вот это примерно такая-же фишка.
|
|
|||||
|
Регистрация: Dec 2009
Сообщений: 45
|
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="showAlert( );" applicationComplete="init( );"> <mx:Script> <![CDATA[ /* Import all the easing classes so its easier to switch between them on the fly without tweaking import statements. */ import mx.effects.easing.*; ]]> </mx:Script> <mx:Style> @font-face { src: url('assets/arial.ttf'); font-family: Arial; unicode-range: U+0054-U+0054, /* T */ U+0061-U+007A, /* a-z */ U+002E-U+002E; /* . (period) */ } .MyEmbeddedFont { font-family: Arial; font-size: 16px; } </mx:Style> <!-- Set zoom effect for 2.5 seconds (2500 milliseconds) and use the Elastic.easeOut easing method. --> <mx:Zoom id="zoom" duration="7500" easingFunction="Elastic.easeOut" target="{embeddedText}" /> <!-- Use advanced font anti-aliasing for the embedded font, set the rotation to 5 degrees, alpha to 80% and loop the animation. --> <mx:Text id="embeddedText" text="The Quick Brown Fox Jumped Over The Lazy Dog." styleName="MyEmbeddedFont" rotation="5" alpha="0.8" fontAntiAliasType="advanced" creationComplete="zoom.play( );" effectEnd="zoom.play( )" /> <mx:String id="fileName" /> <mx:String id="fileSize" /> <mx:String id="message"> The quick brown fox jumped over the lazy dog. The Quick Brown Fox Jumped Over The Lazy Dog. </mx:String> <mx:String id="title">The quick brown fox jumped over the lazy dog?</mx:String> <mx:Script> <![CDATA[ import mx.controls.Alert; private var alrt:Alert; private function init( ):void { var appInfo:LoaderInfo = Application.application.loaderInfo; /* Just grab the filename from the SWF URL. */ fileName = (appInfo.url).split("/").pop( ); /* Convert bytes to kilobytes. */ fileSize = (appInfo.bytesTotal / 1024).toFixed(2); } private function showAlert( ):void { Alert.yesLabel = "Accept"; Alert.noLabel = "Reject"; Alert.buttonWidth = 120; alrt = Alert.show( message, title, Alert.NO | Alert.YES ); /* Make the Alert form's text non-selectable. */ alrt.mx_internal::alertForm.mx_internal::textField.selectable = false; } ]]> </mx:Script> <mx:Style> Alert { titleStyleName: "alertTitle"; messageStyleName: "alertMessage"; buttonStyleName: "alertButton"; dropShadowEnabled: true; shadowDistance: 5; shadowDirection: right; cornerRadius: 20; embedFonts: true; fontFamily: Arial; } .alertTitle { letterSpacing: 0; fontSize: 14; color: green; } .alertMessage { letterSpacing: 0; fontSize: 10; fontWeight: normal; color: black; } .alertButton { letterSpacing: 0; fontSize: 11; cornerRadius: 5; fontWeight: normal; textRollOverColor: green; color: red; skin: ClassReference(null); } .myButtonStyle { embedFonts: true; fontFamily: Arial; fontWeight: normal; fontSize: 24; cornerRadius: 13; letterSpacing: 4; textRollOverColor: red; color: green; skin: ClassReference(null); icon: Embed(source="./assets/iconInstall.png"); } </mx:Style> <mx:ApplicationControlBar id="applicationControlBar" dock="true" > <mx:Label id="info" text="{fileName} ({fileSize}kb)" /> </mx:ApplicationControlBar> <!-- Click to launch Alert control. --> <mx:Button id="btn" label="{btn.getStyle('fontFamily')}" click="showAlert( )" styleName="myButtonStyle"/> </mx:Application> |
|
|||||
|
Регистрация: Dec 2009
Адрес: Москва
Сообщений: 16
|
Блин... use namespace mx_internal; это в С++ если этого не делать, то к командам стандартной библиотеки надо обращаться с префиксом std. Как в вашем примере. Почитайте про пространства имен С++.
|
|
|||||
|
Регистрация: Dec 2009
Сообщений: 45
|
use namespace mx_internal это да, это добавляет все содержимое пространства а пример смотрел особенно вот эту часть alrt.mx_internal::alertForm.mx_internal::textField.selectable я че то в mx.controls.Alert mx_internal не нешел и это класс import mx.core.mx_internal;
нигде не нахожу ![]() |
|
|||||
|
Modus ponens
|
Ну это, говорят же вам, mx_internal - это не класс, а пространство имен, по задумке авторов фрймворка туда складывается все что они либо не придумали как реализовать хорошо, либо какие-то экспериментальные вещи, которым не гарантируется последующая поддержка, либо еще для каких технических целей. use namespace просто говорит вам о том, что методы и свойства объявленые с модификатором доступа определяющимся URI этого пространства имен могут использоваться без явного указания этого URI (или суфикса - указателя на URI).
По умолчанию открытыми пространствами имен являются public (его URI = "") и AS3 (его URI = "http://adobe.com/AS3/2006/builtin"). Есть еще несколько пространств имен которые описывают уровен доступа private, protected, internal - они тоже доступны всегда, но возможност получить доступ к содержимому этих пространств определена на уровне языка, т.е. если вы попробуете То работать не будет, но вот пользовательские пространства имен будут так работать.
__________________
Hell is the possibility of sanity |
|
|||||
|
Регистрация: Dec 2009
Сообщений: 45
|
У меня под 2м билдером работает и если это все работает под 3 и ... то это долеко не эксперементальные вещи. И я не думают что internal относится к private, protected думаю ближе к external а вообще это не internal это mx_internal.
|
|
|||||
|
Регистрация: Dec 2009
Адрес: Москва
Сообщений: 16
|
Это не стэйбл вещи. И надо их использовать с осторожностью, понимая вероятность их изменения, удаления, перемещения в будущих версиях SDK.
|
![]() |
![]() |
Часовой пояс GMT +4, время: 23:36. |
|
|
« Предыдущая тема | Следующая тема » |
|
|