Jump to content

MatroseFuchs

Administrator
  • Content Сount

    46
  • Joined

  • Last visited

  • Battles

    6

About MatroseFuchs

  • Rank
    Able Seaman
  • Insignia

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hello, Thank you for paying attention to this error, as it turned out this is. Unfortunately it's a bug of ModAPI, default allowed urls can't be open now, we'll fix it in one of the next patches. Also if you need to open different url, send me total string of it in PM.
  2. Unfortunately We are currently unable to provide source files for ship models.
  3. MatroseFuchs

    [ALL] ModStation 1.6.1.0

    Please send me the log file in PM.
  4. MatroseFuchs

    [ALL] ModStation 1.6.1.0

    Hello, please upload screen with the exception.
  5. MatroseFuchs

    [ALL] ModStation 1.6.1.0

    Yes, it's safe.
  6. Functions for calculated expressions The list of functions is arranged in the form of a table. Function name in markup Description Example round(number) Mathematical rounding to an integer "round(0.423456)" # 0 toUpper(str) Converts lower case symbols to upper case symbols toLower(str) Converts upper case symbols to lower case symbols (var test:number = "clamp(smth, 0, 10)") tr abs(number) Mathematical module radToGrad(radNumber) Conversion from radians to degrees gradToRad(gradNumber) Conversion from degrees to radians tan(radNumber) Tangent of an angle in radians floor(number) The closest integer that is less than or equal to the specified number ceil(number) The closest integer that is greater than or equal to the number pow(basis, exponent) The basis number is raised to the power of the exponent formatSeparator(number) Grouping the integer part into 3-digit segments, separated by a space. Rounding the fractional part to the second decimal place. "formatSeparator(1103569353.789254232)" # result 110 123 123 123.79 formatFloatingPoint(number, numberOfDigits=1) Rounds the fractional part to the numberOfDigits decimal place. By default, numberOfDigits = 1. "formatFloatingPoint(1.193454334123)" # result 1.2 "formatFloatingPoint(0.423456, 3)" # result 0.423 subst(str, array_values, dict_values) Substitution of the arguments into the placeholders. "subst('first number is %d, second is %d', [50, 51])" subst('%(min)d - %(max)d', [], {min:1, max:2}) countdownFormat(numberSeconds, numberOfDigits, isShowMinutes) Formats the number of seconds into the min:secongs format. If the number of minutes is 0, it displays 00 "countdownFormat(125, 0, true)" TextFormat(stringId, dict_values) or TextFormat(stringId, 'value1', 'value2', ...) Substitution of the arguments into the localization string. formatString(stringId, [<dict_values>, ..., <dict_values>], named) The function unites some logic from TextFormat and htmlTextStyle functions. Allows it to format of substrings separately 1st arg - a formatted string. Could be getting from R-manager. 2nd arg - an array of formatted dictionaries. 3rd arg - a flag which shows of using named keys. Default == false. ----------------------- <dict_values> - formatted dictionary which contains key-value pair. Required keys: 1) value - a formatted substring. Type : str, number, bool. bool values converted to string (true - 'true', false - 'false') and sets into result string. Optional keys: 2) name - key which getting by value from <dict_values> and sets into result string. If 'named' arg is true a key 'name' must be required! If 'named' arg is false a key 'name' is ignoring. Using in pattern string is forbidden (Parse error)! Type : str. 3) style - a name of style preset which will be apply to substring. Type : str. 4) align - possible values: left, right, bottom, top, center, middle. Anotherwise will be generated error IllegalArgNameError (see unbound.log). Default - 'left'. Type : str. 5) hardSpace - a flag which shows what all common (break) spaces will be replaced to NON-break spaces (see Non-breaking_space). Default - false. Type : bool. Using named arguments (htmlText = "formatString( '*** {key1} of the {key2} ', [ {value:'dummy text', name:'key1', style:'HighlightTextStyle', align:'middle'}, {value:'printing', name:'key2', style:'AlertTextStyle'}], true)") ----------------------- Using positional arguments (htmlText = "formatString( '*** {} of the {} ', [ {value:'dummy text', style:'HighlightTextStyle'}, {value:'printing', style:'AlertTextStyle'}])") ----------------------- Parse ERROR! (htmlText = "formatString( '*** {key1} *** ', [ {value:'dummy text', name:'key1', style:'HighlightTextStyle'}])") hardSpace('some text with spaces') The function replaces common (break) spaces to NO break spaces. (text = "hardSpace('dummy insert text with nbsp.')") Rect(x, y, width, height) Creates an instance of the Rectangle class. (scale9grid = "Rect(4, 4, 152, 16)") htmlTextStyle(text, styleName, align='left') This function applies html-formatting to the text, based on an existing style. It has two parameters: text — formatted text styleName — style name (three parameters are used from the style: fontFamily, fontSize, textColor) align — text alignment. By default, it's 'left'. Acceptable parameters are the same as for TextField in as3: left, right, justify, and center. leading - An integer representing the amount of vertical space (called leading) between lines. (tf (htmlText = "htmlTextStyle('Animation Block', 'GoldTextStyle') + htmlTextStyle('!!!', 'MainTextStyle', 'center')") ) min(x, y) Minimum number of the two. return x < y ? x : y (var test:number = "min(smth, smth2)") max(x, y) Maximum number of the two. return x > y ? x : y (var test:number = "max(smth, smth2)") clamp(v, lo, hi) Limits the value of "v" within "lo" and "hi" if (v < lo) return lo; if (hi < v) return hi; return v; (var test:number = "clamp(smth, 0, 10)") playSound(resourceSoundId) Plays a sound file. (exec "playSound(R.sounds.gui.minimize)" on='evBtnLeftClickEvent') randInt(min, max) Generate integer number in the range [min, max] (text = "'rand integer = ' + randInt(10, 20)") randFloat(min=0.0, max=1.0) Generate float number in the range [min, max]. By defaults min=0.0, max=1.0 (text = "'rand float = ' + randFloat(10, 20)") (text = "'rand float = ' + randFloat()")
  7. Event An event is an object, generated and dispatched upon any action of the user (a mouse click, a button pressed, etc.). To distribute the event, the dispatch method is used. Events are defined in the scope. (event valChanged) In Unbound, events can be generated from: The core C++ part. For example, the valueChanged event is generated in the slider block, when its value changes. (dispatch valChanged on='valueChanged' dir=1) The Scaleform part. For example, the event of clicking on the display object. (block (style (width = 100) (height = 100) (backgroundColor = 0xff00ff00) ) (bind alpha "0.5" init=false on='click') ) Difference Between Subscription to Events with the Help of on and event Subscription of binding structures can be implemented in two ways: By passing the event's name to the on argument. (bind eventArgs "$event" init=false on='eventScope') By passing the nested event object. (trace "$event" init=false (event "eventScope")) The event can be generated in: Scalefom; for example, the click event of the mouse, or the keyDown event of the keyboard. The Core C++ part of Unbound; for example, the slider block generates the sliderPositionChanged event when the slider thumb's position changes. Markup, i.e., the event has been defined in the element's scope and is generated in its definition. (def element TestView() layout = true entrance=true (scope (event eventScope) ) (element Button (dispatch eventScope on='click') ) ) Essentially, it isn't generation of an event; it is transformation from a Scalefom/Core C++ event (in this example, it is 'click') into the event of the scope (in this example, it is eventScope) Let's consider how these two approaches differ. If the event is generated in Scaleform or Core C++ Unbound, you can create subscription only by using the on argument. If the event is defined in the element's scope, there are two subscription cases, depending on where the subscription is located. Subscription inside the scope can be done both via on and event Subscription outside of the scope can be done only via event Consequently, you can use the on argument to subscribe only to the events, generated by the target object. Let's consider separately subscription to events inside the scope when an element is created. (element Button (scope (label = 'default text') (bind label 'leftClick' init=false on='evBtnLeftClickEvent') (bind label 'rightClick' init=false on='evBtnRightClickEvent') ) ) The 'evBtnLeftClickEvent' and 'evBtnRightClickEvent' events are generated in the definition of the Button element. If you use the event structure, the events must be defined in the parent scope.
  8. Element An element is a top-level object. An element has its own name, so it can be called (inter alia, from outside the document that contains it) or reused. There are two ways to reuse an element: create its instance by calling a Controller or create its instance by calling the element method with the element's name as the argument. An element has its individual scope, but variables of the parent scope can be set to it. Element has params: the layout boolean parameter, which enables and disables the layout system. Possible values: layout=true|false. the isReadyTracked boolean parameter, which turns on (it equals true) tracking of dependency resolving for each child of element. Also tracking that additional conditions are ok for some specific blocks. For example, image block has additional condition - image is loaded. Element is hidden while tracking works. Event $evReadyChanged is triggered when dependencies are resolved and additional conditions are ok. If isReadyTracked equals false, than $evReadyChanged is triggered when nodes tree is build. the entrance boolean parameter, determines root element for View. Possible values: entrance=true|false. Please read the view resource usage for the details the initType dict/map parameter, used to specify that the run-time unbound object will be not the container block (for element definition by default) but it will be the block associated with initType. When you defining the type different from CONTAINER you have to use only the syntax of that block. For example, BUTTON is inherited from CONTAINER, you can define all kind of standard blocks inside, but at the same time you can use (label =) setter which is part of (button) block syntax. Usage example:
  9. Controllers A controller is an entity that applies one type of action to the assigned object. For the $Instance, $FxInstance, and $Repeat controllers, specify the object in the renderer field. The $Animation controller targets the parent object. The $Sector controller is an object itself. $Instance This controller adds an instance of the element to the stage. renderer sets the element, with which the controller will perform its operations. Available for binding. layout determines whether the layout system is enabled or not. By default, the value is false. args is a controller method. It passes the value from the parent scope to the renderer. exprs is carried out inside the renderer, but this method has access to the parent scope. exprs can contain expressions and bindings. With the help of this method, the controller allows you subscribe to changes in variables from the parent scope. enabled assigns the expression, which runs the controller. The controller is triggered if the expression is true. In some cases, you don't need to create a separate element — you can add all the blocks to exprs and set the controller's layout parameter as true. $FxInstance This controller temporarily adds an instance of the element to the stage. The instance is removed from the stage when its lifetime expires. The lifetime is measured in seconds. renderer, args, exprs, enabled, and layout — the same as in the $Instance controller. create — this controller method creates an instance of the element. Calls of this method can be subscribed to an event in the scope. lifetime determines how long the element will exist on the stage. If not set, the default lifetime is 15 seconds. $Repeat This controller creates the specified number of renderer copies. renderer, args, exprs, enabled, and layout — the same as in the $Instance controller. count sets the number of renderers. In count, you can specify any number or an expression, which will return a number. removeChildAt(index) removes from the stage a renderer, whose id is index. $index — an integer, which shows the child's ordinal number from 0 to the last element. The first created element will have $index=0, etc. By default, this variable is in the child's scope since the child's creation. $Animation This controller animates values of: Properties of the target display object Variables from scope Variables from styles Available controller methods with examples of how to fill in the parameters: play — launch one animation playSeq — launch a sequence of animations stop — stop an animation (stop id="anmId" # id of the animation that needs to be stopped. The id is not set by default. If it is set, all the animations launched by this controller will be stopped. ) stopSeq — stop an animation sequence (stopSeq id="anmId" # The id of the sequence, which needs to be stopped. The id is not set by default. If it is set, all the animations launched by this controller will be stopped. ) Available easings: Examples: This is an example of an animation, triggered when you click the button. The text block displays changes of animationVariable. Example of an animation trigger — the condition that triggers the animation. This animation is triggered when the value in the condition changes to the opposite value. Its difference from enabled is that enabled is triggered only when the condition is true. Warning: The peculiarity of this controller is that it memorizes the animated values in the to parameter without taking into account the delay. Therefore, if the animated values change during the delay, the controller will keep operating old values. $ToolTipEvent This controller adds the following functionality: a tooltip is created when you point the cursor to the target display object. Note: The content property is necessary to be sent to create a tooltip. Example of creating a simple text tooltip: You can add localization keys to the header, body, note, and alert: The controller allows you to create a customized tooltip with unique content. To do this, you need create an element with the content in the markup. Then create ViewModel and View. The View must be inherited from ViewImpl. Override the createToolTipContent method in the view, which needs to show the tooltip. $ContextMenuEvent This controller adds the following feature: a context menu is created when you right-click the target display object. # Here is context menu. (controller $ContextMenuEvent # Unique ID of context menu. Context menu uses constant. (bind content "exampleMenuID") ) where exampleMenuID is a unique id for identifying the context menu in the view. Override the createContextMenuContent method in the view, which needs to show the context menu. def createContextMenuContent(self, event): if event.contentID == ContextMenuID.EXAMPLE_ID: return WTypesContextMenuContent(self.uniqueID) return None $PopOverEvent This controller adds the following functionality: a popover is created when you click the target display object. # Here is pop up. (controller $PopOverEvent (flow = "Flow.VERTICAL") ) flow is the direction, in which the popover shows up. Flow.VERTICAL — the popover is displayed above or below the target object, depending on the screen size. Flow.HORIZONTAL — the popover is displayed to the left or right of the target object, depending on the screen size. The controller tries to position the popover in such a way so that its borders don't go beyond the screen. $AdjustPosition This controller adjusts the target object's position in such a way so that it fits into the client screen. (controller $AdjustPosition (original_x = 10) # The x coordinate of the starting point for calculations. If not set, by default it is the x coordinate of the target object. (original_y = 15) # The y coordinate of the starting point for calculations. If not set, by default it is the y coordinate of the target object. (offset = "10.0") # Offset from original_x and original_y. (default = "15.0") # If the coordinates are negative, this value will be set. ) $Sector This controller allows to draw sector using flash.display.Graphics of that controller target
  10. Base blocks of markup language Constant Unbound constants have the same purpose as those in other languages: they serve to store fixed values. Two types of constants can be used in Unbound: Global constants The (def function is used to declare a global constant. The value of the constant is added after its name. In the example below, C_ALLY is the constant's name, and 0xFF80c0ff is the constant's value. Local constants These constants are declared in the element's scope and can be used only inside this element.
  11. Declarative Markup Language and S-expressions A markup consists of S-expressions . There are four types of S-expressions, each intended for a specific action: Call method (<method name> <positional argument value>* <named argument>* <nested s-expression>+ ) <named argument> := <argument name> = <argument value> (bind isEnabled "$event.enabled" init=false (event "isEnableChanged") ) bind - <method name> isEnabled, "$event.enabled" - <positional argument value>* init=false - <named argument>* (event "isEnableChanged") - <nested s-expression>+ Add definition (def <definition type> <difinition name> (<declaration argument>*) <named argument>* <nested s-expression>+ ) <declaration argument> := <argument name> : <argument type> [ = <default value> ] <named argument> := <argument name> = <argument value> This definition is essentially a specific instance of an S-expression method. It was introduced only for the special syntax, used for declaring parameters. (def element TestView(name:str = '', count:number) layout=true (block ) ) Set a property value (<property name> = <property value>) (style (width = 100px) ) (tf (text = 'Hello world!') ) Get a property value (.<property name> <nested s-expression>+ ) (.graphics (lineStyle 1 0xffffdc84 1) (beginFill "0xff414141" "0") (drawRect 0 0 450 64) (endFill) ) The entire markup is based on these four types of expressions. Macros A macro is a named and parametrized markup fragment, which is added to the place where it's called on the parsing stage. Macros are implemented on the AST(Abstract syntax tree) level. Definition of a macro: (def macro <macro name> (<declaration argument>*) <nested s-expression>+ ) <declaration argument> := <argument name> : <argument type> [ = <default value> ] (def macro StatusesVehicleTypes(width:number=100%, height:number=100%, renderer:str='VehicleTypeItem', name:str='statusesVehicleTypes') (element List "name" "renderer" "width" "height" (scope (containerFlow = "Flow.HORIZONTAL") (listVscrollPolicy = 'off') (listHscrollPolicy = 'off') ) ) ) You can run a macro with the help of the key word — macro. (macro <macro name> <positional argument value>* <named argument>*) (macro StatusesVehicleTypes 160 height=32) Though it looks like an ordinary method call, it's not. The macro's content is added on the parsing stage. In the definition of the macro, you can use the macros that were defined before. The resolve operation is done recursively. (def macro ComponentStateBase (statesDict:expression) (macro ComponentStateBaseScope "statesDict") (macro ComponentStateBaseContent) ) Markup Execution The engine that executes the markup isn't tied to any specific features. It doesn't keep any knowledge base on sprites, scopes, etc. A "target object" is the current object, subjected to the operations that are described in the S-expressions. S-expressions are divided into types: method, setter, and getter. On this level, even a definition is simply a method. The first execution of a markup happens after the file's text has been uploaded to the framework. After the file is parsed, we get a list of S-expressions, contained by the file (as a rule, these are definitions and setups of global constants). A fake object is created to execute this list of S-expressions (though, in fact, these methods don't need it). Once a definition has been declared, the engine starts executing the list of S-expressions. The engine creates the corresponding object and S-expressions, which are contained in the definition's body and applied to it. As the S-expressions are being executed, the target object changes. This happens along with the execution of nested S-expressions. For them, the target object will be the object, returned by the parent S-expression. If the S-expression didn't return anything or returned something other than an object, the nested S-expressions won't be executed. Values (including objects) can be returned by methods and getters. The example below shows how a target object is changing: Data Types In markup, variable must be strictly divided into types (arguments of definitions, variables of scope). Types are verified on the execution stage (except for macros — they are verified on the parsing phase). This helps you identify errors much faster. Type Description Syntax Comments number number 12.34 For numbers, you can specify the unit of measure. percent 12.34% pixels 12px bool boolean expression true / false str string 'text123' single quotes dict dictionary {a : 1, b: 2} array array [1, 2, 3] expression calculated expression "a ? 1 : 2" inside double quotation marks A constant can't be defined inside this expression. gfx указатель на любой GFx::Value no a constant cannot be defined in the layout and in the expressions object указатель на оперируемый объект no a constant cannot be defined in the layout and in the expressions Note: An important peculiarity of working with string literals and variables is that you don't need to use single quotation marks, because the parser interprets any value as a string. Consequently, there are two ways of declaring strings. This peculiarity reveals itself when you use binding structures (bind, bindcall, sync, dispatch). Example: # Dispatch of the evBtnUpEvent event (dispatch evBtnUpEvent on=mouseUp) The first argument of the dispatch function is a string-type variable, but you don't need to use single quotes. Keep this peculiarity in mind when working with markup. Enums In expressions, you can use the enumerations that were set in the core c++ part of Unbound. Enum name Properties Description Example Comments Flow HORIZONTAL VERTICAL - by default value TILE_HORIZONTAL TILE_VERTICAL REVERSE_HORIZONTAL REVERSE_VERTICAL These properties determine how nested display objects are positioned. (block (style (flow = "Flow.HORISONTAL") ) ) # This is the equivalent to what's written above: (hblock ) For blocks with a specified flow value, you can use the following aliases: block — vertical block hblock — horizontal block vtile — vertical tile block htile — horizontal tile block reverse — vertical block with a reverse order of elements in it hreverse — horizontal block with a reverse order of elements in it For block property flow = Flow.VERTICAL ZIndex FOREGROUND BACKGROUND Set the z-index of the display object, and it will determine the object's z-positioning in the parent container. (block (style (zindex = "ZIndex.BACKGROUND") ) ) Easing line elastic_in elastic_out bounce_in bounce_out back_in back_out cubic_in cubic_out quint_in quint_out expo_in expo_out expo_in_out sine_in sine_out sine_in_out Types of easing for animation. (controller $Animation (play duration=0.3 to={alpha:0} easing="Easing.cubic_out") )
  12. Basic Functionality Basic functionality determines the framework's basic capabilities: Forming a scene (creating and adding sprites, textfields, symbols, and blocks) Scope, bindings system Building definitions (element, css, animation, macro, constant) Holders of global data (enums, global constants, global pointers to objects, global methods) Build stage The key feature of Unbound markup is the ability to create, configure, and add instances of display objects (DOs) to the corresponding target object in a display list. The target object is the parent DO for the current markup fragment. All DOs can be divided into two groups, based on whether they have or don't have the layout system. The layout system serves to position the DO on the stage. (block (tf ) ) where the block node is the target object for the tf display object. Display Objects Without Layout System top-level methods Description sprite Create empty instance of Sprite symbol Create instance of Symbol (MovieClip or Sprite) from library by linkage bitmap Create instance of Bitmap from library by linkage tf Create instance of TextField element Creating an instance of the element described in the layout bitmapImage Create instance of Bitmap with argument BitmapData Define Element A high-level DO of a markup is an element. An element is a named and parametrized sprite-based markup fragment. An element can have a Scope, which contains the data that are available in the element's body. Work with an element consists of two stages: "definition" and "create instance". Elements are defined using the def method. Example definition: (def element CommanderPersonalInfo() layout=true ) Example create instance: (element CommanderPersonalInfo) Scope A scope is a storage of data and events, available in the body of the element's description. Only an element can have a scope; the remaining DOs can work only with the scope of the parent element. All the variables and events, used in the element's body, must be defined in the scope. If you try to call a property or event that doesn't exist, you'll get the following error: access of undefined scope event 'nameEvent'. top-level methods description scope This method returns the element's scope, so that you can work with it. (scope (var lvlVal:str = '') (var title:str = '') (var cost:str = '') (var text:str = '') (var lvlTextColor:number = 0xffcac8c1) (var imageUrl:str = '') ) Bindings Bindings are responsible for simple synchronization of data (property, method call, event dispatch). Three elements are synchronized: Property Method call Event Bindings take a snapshot of the execution data and use it when calculating expressions. This is done for the expressions to contain all the data, which were available at the moment when the binding was initialized. top-level methods Description scope -> object bind Adding a value to the object's property. bindcall Calling a method from the object. object -> scope sync The value of the parameter in the scope is synced with the value of the object's parameter. dispatch The event in the scope is synced with the event, generated by the object (the event is dispatched into the scope, based on the object's event). All bindings have four common properties: watch — whether to follow changes in the values of properties in the scope, which are used in expressions. init — whether to execute the relevant action when the binding is initialized. on — the target object's event, which will trigger the binding. enabled — a boolean value, which is used to enable and disable the binding's execution. and one common method: event — adds any event as a trigger for the binding. Bind Syntax: (bind scopeVar|property "scopeVar|$target|$event.field" [init=false|true] [watch=false|true] [on='scopeEventName|flashEventName|cppEventName']|[(event "scopeEventName")] [(enabled "expression")]), by default it is as follows: init=true watch=true You can sync both the variable from the scope and the property of the target object. To sync the variable from the scope, you should place "bind" inside "scope". (scope (var count:number = 30) (var total:number = 100) (var percent:number = 0) (bind percent "count / total") ) To sync the property of the target object, "bind" must be called in the target object, whose property is being synced. (scope (var vehicleType:str = 'vehicleHeavy') ) (tf (bind text "vehicleType") ) In both cases, if any variable from the expression changes, the expression is calculated and the result is added to the synced variable or property. You can manage this behavior through the watch=true|false property. Another way to sync an expression is to subscribe to an event. There are two methods of subscribing to an event: Set the event name as the on argument. This method is used for subscribing to flash events or events, generated from core c++. If the event has arguments, you can access them via the $event object. All the variables must be known by the time the expression is executed in bind. But the arguments will be added to the $event only if the event has been generated. As no event has happened so far, the $event is empty at the start. Therefore, all binding types have the init=true|false property, which regulates the binding's behavior during initialization. (tf (class GrandTitleTextStyle) (text = 'default text') (bind text "$event.localX" init=false on='click') ) Dispatch the event into the scope, based on the object's event. (scope (event onCustomEvent) ) (tf (bind text "$event.localY" (event "onCustomEvent")) (dispatch onCustomEvent on='click') ) Note: You can subscribe to an event of a specific instance of an element in the scope. In this case, you must set this event name as the on argument. (element ButtonPrimary (scope (bind label "$event.localX+ $event.localY" init=false on='evBtnLeftClickEvent') ) ) You can manage how the synchronization is executed using a nested structure, called enabled. In this structure, you can set any logical expression, so its result will be a boolean value. If you want to subscribe to changes in enabled, use the bind structure. Bindcall Syntax: (bindcall functionName "scopeVar|$target"* [init=false|true] [watch=false|true] [on='scopeEventName|flashEventName|cppEventName']|[(event "scopeEventName")] [(enabled "expression")]), by default it is as follows: init=false watch=true Bindcall is used to call a method of the target object if an event occurs or any argument changes. Below is an example of calling the gotoAndPlay method of the mc display object: (mc 'CloseBtnCrossAnim' (bindcall gotoAndPlay "stateFrame") ) Thus, the gotoAndPlay method will be called when the stateFrame variable is changed. Here's another example. This time, the play method of the $Animation controller is called: (controller $Animation (bindcall play duration=0.2 from={alpha:0} to={alpha:0.5} (event "evBtnOverEvent") (bind enabled "_isPressed")) ) The event and enabled parameters behave just like the bind structure. Dispatch Syntax: (dispatch scopeEventName on='flashEventName|scopeEventName|cppEventName'|[(event "scopeEventName")] [args="{key1: value1, ...}"] [dir=0|1|2] [(enabled "expression")]), by default it is as follows: dir=0 Dispatch of an event, based on another event generated in Scaleform or Core c++ Unbound. Before dispatching the event, you must declare it in the scope. (scope (event onClick) ) (dispatch onClick on='click') Passing Arguments When dispatching events, you can pass arguments in the form of a dict. By default, if the args parameter hasn't been set, all the properties of the original event (the one that serves as a trigger) are passed to the dispatched event. (scope (event onClick) ) (element ButtonPrimary (dispatch onClick on='click') ) (trace "$event" init=false (event "onClick")) unbound.log ======================================================================== ------------------------------------------- UBTRACE: {altKey:false,bubbles:true,buttonDown:false,buttonIdx:0,cancelable:false,clickCount:0,commandKey:false,controlKey:false,ctrlKey:false,currentTarget:°FЧ',delta:0,eventPhase:2,localX:41,localY:18,mouseIdx:0,nestingIdx:0,relatedObject:[null],shiftKey:false,stageX:41,stageY:18,target:°FЧ',type:click} If you specify at least one argument, the properties of the source event will not be passed. (scope (event onClick) (var argument:number = 100) ) (element ButtonPrimary (dispatch onClick args="{param: argument}" on='click') ) (trace "$event" init=false (event "onClick")) unbound.log ======================================================================== ------------------------------------------- UBTRACE: {param:100} Event Dispatch Direction You can manage the event's dispatch direction via the dir parameter. This parameter can have one of the three values: 0 — the event is dispatched inside the element. By default, dir=0. 1 — the event is dispatched from the child object to the parent object. Note: Don't forget to declare the event in the scope before using it. Though the event has been declared in the scope of the ChildElement definition element, you must also declare it in the scope of TestView. 2 — the event is dispatched from the parent object to the child object. Identification of Events In the examples above, one nested element was dispatching an event, and only one instance was handling it. But quite often, there are several instances on the same level, so it's hard to identify which of them generated the event. Let's see an example below: There are four ChildElement instances on the stage, and each of them is dispatching the onClick event. The text field will receive events from each of these instances. Of course, you can identify the events by IDs of the instances in the bind expression. But it's easier to redispatch the events from the ChildElement's scope into the parent object's unique event. Consequently, the onClickChild1 event is synced with the onClick event only for the button whose id=0. As a result, the text property of the tf block will change only if you click on this button. Sync Syntax: (sync scopeVar from='getter|$target|$event.field' [init=false|true] [on='flashEventName|cppEventName']|[(event "scopeEventName")]) Sync binding allows linking a variable from the scope with an object property. In the example above, the click event will update the variables in the scope: The scopeText variable will become equal to the value of 'clickMe' (the "text" property of the text block). The clickedButton variable will become equal to the index of the pressed mouse button (0 for left mouse button, 1 for right mouse button, and 2 for middle mouse button). The scopeObject variable will reference the current block. This is so because the $target object references the clicked tf object. Controllers A controller is atomic functionality applied to the target object. It allows you to expand the functionality by applying custom logic to the object. Controllers are written with С++. top-level methods controller This method creates a controller and applies it to the target object. (controller $Animation (play duration=0.2 to="{ alpha:(isMouseOver ? 1.0 : 0.0), visible:(isMouseOver ? true : false) }") ) Customizing Display Object's Style Elements and blocks have a style. It allows you to configure their visual presentation, for example, change size, apply filters, etc. top-level methods style This method returns the current DO's style, so that you can work with it. Each block has its own set of style properties. For example, for the tf block, you can customize font, size, and color. (tf (style (fontFamily = $TitleFont) (fontSize = 36) (textColor = 0xf5eed5) ) ) By changing a style's layout properties (paddings, margins, position, flow, etc.) you can adjust the block's position. (block (style (position = "absolute") (bottom = 18px) (paddingLeft = 24px) (paddingRight = 24px) ) ) Style is available only for objects with the layout system, namely elements whose layout=true and all kinds of blocks, inherited from the BaseBlock in c++. If you try to call a style property of DOs without the layout system, you'll get the following error: access of undefined method 'style' through a reference with type element.
  13. System Level Calculated expressions Unbound allows working with so-called "calculated expressions" (not to be confused with S-expressions). These expressions are calculated on the execution stage. The content of the expression is inside quotation marks (""). For the purpose of convenience, we'll call them simply "expressions," and if an S-expression is meant, we'll specify this explicitly. Expressions are designed for doing unsophisticated data processing and forming values of properties or method call parameters. In the expressions, you can use the variables and events (which were declared in the scope), numeric, string, and boolean literals, as well as operators. (tf (text = "' ' + tankmanName + ' — '") ) (mc AimForShipIcon_pro (gotoAndPlay "isAimed ? 'in' : 'out'") ) Such expressions will be calculated while executing the markup, namely when methods are called. But they can also be used for defining a parameter in the S-expression method and for setting the value in the S-expression setter. (def element List(hscroll_bar:str) layout=true ... (element "hscroll_bar" "name + 'HorScrlBar'") ... ) Note that these expressions will be calculated only once, and it won't be tracked whether the data is updated or not. To track that the data is updated, use the binding mechanism. Action Script syntax is used as the basis. The following operators can be used in expressions: Grammar Expressions can also call functions. (trace "toUpper('Skorpion G')")
  14. MatroseFuchs

    [ALL] ModStation 1.6.1.0

    All greetings, these issues with modder ports are associated with events features. We are working on it, unfortunately I can not say to which version it will be fixed.
×