Skip to main content

"Action Script" from Programming Template

How do I get memory, i.e how are variables declared ? And specific facts and constraints about variables ?


Ex : var food:String;
food=”pizza”;
Var : keyword, needed by syntax
Food: user specific name
String: data type, it can be class name or interface name.
trace("My favorite food is " + food);
// displays "My favorite food is pizza"
________________________________________________________________
How do we get the entry point for the program execution ?


Select File > New.
In the New Document dialog box, select Flash Document, and click OK.
A new Flash window is displayed.
Select File > Save. Select the same folder that contains the Greeter.as class file, name the Flash document HelloWorld.fla, and click OK.
* In the Flash Tools palette, select the Text tool, and drag across the Stage to define a new text field, approximately 300 pixels wide and 100 pixels high.
* In the Properties panel, with the text field still selected on the Stage, set the text type to “Dynamic Text” and type mainText as the instance name of the text field.
* Click the first frame of the main timeline.
* In the Actions panel, type the following script:
var myGreeter:Greeter = new Greeter();
mainText.text = myGreeter.sayHello();
Save the file.

To publish and test an ActionScript application using the Flash authoring tool:

  1. Publish your application and watch for compilation errors. In the Flash authoring tool, select Control > Test Movie to compile your ActionScript code and run the HelloWorld application.
  2. If any errors or warnings are displayed in the Output window when you test your application, fix the causes of these errors in the HelloWorld.fla or HelloWorld.as files, and then try testing the application again.
  3. If there are no compilation errors, you will see a Flash Player window showing the Hello World application.

To publish and test an ActionScript application using the Flash authoring tool:

  1. Publish your application and watch for compilation errors. In the Flash authoring tool, select Control > Test Movie to compile your ActionScript code and run the HelloWorld application.
  2. If any errors or warnings are displayed in the Output window when you test your application, fix the causes of these errors in the HelloWorld.fla or HelloWorld.as files, and then try testing the application again.
  3. If there are no compilation errors, you will see a Flash Player window showing the Hello World application.
_________________________________________________________________________
3. How does dynamic memory handled ? Is it supported in first place ?
Yes, using “new” keyword.


_________________________________________________________________________


4. What are the datatypes which are supported ?


Boolean
Int
Null
Number
String
Void
Object
_________________________________________________________________________
5. Is user defined data types supported ? If so how you do it ?
Yes, the language follows object oriented programming paradigm, So, classes are allowed. And contained under a namespace notion of “package”.
Package com.examples.shapes{
Public class Rectangle{
//define the rectangle class here.
}
}


_________________________________________________________________________
6. How do you cast from one data type to other data type ?
There are two type of conversions : 1. Implicit conversions 2. Explicit conversions.
class A {}
class B extends A {}

var objA:A = new A();
var objB:B = new B();
var arr:Array = new Array();

objA = objB; // Conversion succeeds.
objB = arr; // Conversion fails.
var quantityField:String = "3";
var quantity:int = int(quantityField); // Explicit conversion succeeds.
_________________________________________________________________________
7. What are the program control options available ?
If ( boolean expression ) {
}
Else
{}
-------------
if(boolean expression)
{}
Else if(boolean expression)
{}
Else
{}
---------------
switch(boolean expression)
{
Case”match1” : //statements ; break;
Case “match2” : //statement ;break;
Default: //default statements
}
_________________________________________________________________________


8. How are boolean operations supported ?
  1. Equality operator( == ) : compare the value of the right side with that of the left side.
  2. & : bitwise AND operation.
  3. << : bitwise left shift
  4. ~  : bitwise NOT
  5. | : bitwise OR
  6. >> : bitwise right shift
  7. >>> : bitwise unsigned right shift
  8. ^ : bitwise XOR
  9. Bitwise compound assignment operations are supported.
_________________________________________________________________________
9. What is the operation precedence applied in compile operation ?
_________________________________________________________________________
10. What are the operations supported? [ Arithmetic and special ]
_________________________________________________________________________
11. How do you subprogram ?
function sum(base:Number, … number): Number{
var result: Number = base;
For each (var num:Number in numbers)
{
result+=num;
}
return result;
}

_________________________________________________________________________

Comments

Popular posts from this blog

Event Sourcing with CQRS.

  The way event sourcing works with CQRS is to have  part of the application that models updates as writes to an event log or Kafka topic . This is paired with an event handler that subscribes to the Kafka topic, transforms the event (as required) and writes the materialized view to a read store.

GraphQL microservices (GQLMS)

I'm curios of GraphQL !     -  GraphQL is an open-source data query and manipulation language for APIs, and a runtime for fulfilling queries with existing data. GraphQL was developed internally by Facebook in 2012 before being publicly released in 2015. It should be solving a problem in querying data !     -GraphQL lets you ask for what you want in a single query, saving bandwidth and reducing waterfall requests. It also enables clients to request their own unique data specifications. A case study ?!    -https://netflixtechblog.com/beyond-rest-1b76f7c20ef6 So, This is just another database technoloy ?  -  No. GraphQL is often confused with being a database technology. This is a misconception, GraphQL is a   query language   for APIs - not databases. In that sense it’s database agnostic and can be used with any kind of database or even no database at all. Source:   howtographql.com