• About Us
  • Classroom Training
  • Online Training
    • Self Paced Courses
      • Android Development for Beginners
      • HTML and CSS For Beginners (with HTML5)!
      • Javascript for Beginners
      • C Programming: iOS Development Starts Here!
      • Objective C For Beginners
      • PHP MySQL For Beginners
      • Web Development Code Camp
    • Live Instructor Courses
      • HTML and CSS with HTML 5 (Live)
      • Javascript for Beginners (Live)
      • C Programming for Beginners (Live)
      • Objective C for Beginners(Live)
      • Android Development Code Camp (Live)
      • iOS Development Code Camp (Live)
      • HTML5 & Advanced Client Side Development (Live)
      • Actionscript for Beginners (Live)
  • Forum
  • Testimonials
  • Contact Us
    • Actionscript
    • Android
    • C/C++/Objective C
    • HTML/CSS
    • iOS
    • Java
    • Javascript
    • PHP

Archive for November, 2011

Android Development: Creating Custom Buttons

Posted by Mark Lassoff on November 21st, 2011 | No Comments

In this Android development tutorial, Mark will show you how to create a custom button and place it within your Android application. If you’ve been working with Android development, you might be surprised how easy it easy to produce and use a custom button. The custom button graphic can have three states, and Mark will you show you the XML to display the button and Java code to make the button execute a task.

main.xml

1
2
3
4
5
6
7
8
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/custom_button" android:id="@+id/btnTv"></Button>
</LinearLayout>

custom_button.xml

1
2
3
4
5
6
7
<?xml version="1.0" encoding="utf-8"?>
<selector
  xmlns:android="http://schemas.android.com/apk/res/android">
   <item android:drawable="@drawable/btn_over"
   	android:state_pressed="true" />
   <item android:drawable="@drawable/btn_normal" />
</selector>

CustomButtonExampleActivity.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package tv.learntoprogram.customButton;
 
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
 
public class CustomButtonExampleActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
 
        Button btn = (Button)findViewById(R.id.btnTv);
 
        btn.setOnClickListener(new View.OnClickListener() {
 
			@Override
			public void onClick(View v) {
				Toast.makeText(getApplicationContext(), "You pressed the custom button",Toast.LENGTH_SHORT).show();
 
			}
		});
 
    }
}

How To Actionscript: Events

Posted by Mark Lassoff on November 18th, 2011 Actionscript, events, Flash Builder, Flash Professional, Flex, MXML, tutorial, Video
| No Comments

Events are serious business in Actionscript– When the user clicks, double clicks, focuses on an object, right clicks, etc., an event is generated. Dealing with those events is a large part of successful Actionscript programming. In this video, Mark will teach you the basics of events and also take a look at the event object and how you can use it to write more efficient code.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
			   xmlns:s="library://ns.adobe.com/flex/spark" 
			   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="500" minHeight="400"
			   creationComplete="init()">
	<fx:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
	</fx:Declarations>
	<fx:Script>
		<![CDATA[
			private function init()
			{
				btnOne.addEventListener(MouseEvent.CLICK, clickOne);
				btnTwo.addEventListener(MouseEvent.CLICK, clickOne);
			}
 
			private function clickOne(event:MouseEvent)
			{
				//txtResult.text = "Button One has been clicked";
				var id = event.target.id;
				if(id == "btnOne")
				{
					txtResult.text = "Button One has been clicked";
				} else
				{
					txtResult.text = "Button Two has been clicked";
				}
			}
			/*
			private function clickTwo(event:MouseEvent)
			{
				txtResult.text = "Button Two has been clicked";	
			}
			*/
		]]>
	</fx:Script>
	<s:Button x="9" y="10" label="One" id="btnOne"/>
	<s:Button x="10" y="39" label="Two" id="btnTwo"/>
	<s:TextArea x="156" y="10" height="50" id="txtResult"/>
</s:Application>

How To Actionscript: Arrays

Posted by Mark Lassoff on November 17th, 2011 Actionscript, arrays, Flash Builder, Flash Professional, Flex, tutorial, Video
| No Comments

Arrays are an important structure in any programming language. Arrays are designed to allow the programmer to hold multiple pieces of data in a single structure. In this tutorial Mark, demonstrates the basics of arrays using Actionscript and Flash Builder. Mark creates two different arrays and populates them with data. Then he demonstrates several array methods that allow you to add to the array, delete from the array, and manipulate the array in several other ways.

If you are using Actionscript with Flash Professional, Flash Builder or Flex, you will find this tutorial useful.

This “How To Actionscript” series is designed for the developer who wants to learn different Actionscript techniques quickly and easily.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
			   xmlns:s="library://ns.adobe.com/flex/spark" 
			   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="400" minHeight="500"
			   creationComplete="init()">
	<fx:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
	</fx:Declarations>
	<fx:Script>
		<![CDATA[
			function init()
			{
				//Formal
				var myFamily:Array = new Array("Brett", "Kerry", "Joan", "Rick", "Kevin", "Conner", "Colleen", "Carol");
				var languages:Array = ["C++", "Objective C", "Actionscript", "Java" , "PHP" , "Assembly"];
 
				//txtResult.text =  myFamily.toString();
				//txtResult.text = myFamily[3];
 
				languages[(languages.length+1)] = "C#.net";
				languages.push("Visual Basic");
				var returnedElement = languages.pop();
 
				for(var x=0; x < languages.length; x++)
				{
					txtResult.text += languages[x] + "\n";
				}
 
				txtResult.text += "Returned Element: " + returnedElement;
 
 
			}
		]]>
	</fx:Script>
	<s:TextArea x="18" y="10" id="txtResult"/>
</s:Application>

  • Pages

    • About Us
    • Actionscript for Beginners (Live)
    • Android Development Code Camp (Live)
    • Android Development for Beginners
    • C Programming for Beginners (Live)
    • C Programming: iOS Development Starts Here!
    • Classroom Training
    • Contact Us
    • Forum
    • HTML and CSS (with HTML5)!
    • HTML and CSS with HTML 5
    • HTML5 & Advanced Client Side Development (Live)
    • Introduction to Javascript
    • iOS Development Code Camp (Live)
    • Javascript for Beginners (Live)
    • Logos slide show
    • Objective C For Beginners
    • Objective C Programming for Beginners(Live)
    • PHP MySQL For Beginners
    • scheduler
    • Student Registration Form
    • Testimonials
    • Web Development Code Camp
  • Archives

    • November 2011
    • October 2011
    • September 2011
    • August 2011
    • July 2011

    Categories

    • Actionscript (5)
    • Ajax (1)
    • Android (3)
    • C/C++/Objective C (2)
    • Events (2)
    • Flash (2)
    • Free Tutorials (15)
    • HTML/CSS (2)
    • Javascript (3)
    • On Learning (2)
    • PHP (3)
    • Uncategorized (1)
    • Web Development Bootcamp (1)
  • Blogroll

    • Documentation
    • Plugins
    • Suggest Ideas
    • Support Forum
    • Themes
    • WordPress Blog
    • WordPress Planet
  • Meta

    • Register
    • Log in
    • WordPress

    Subscribe

    • Entries (RSS)
    • Comments (RSS)

    What is ?

    We train software, web and mobile developers. Our classes geared to the way adults learn are available online, or in-person at your office or training center.

    New Android Book

    Android Programming Code Camp by Mark Lassoff. Coming in 2012. Finally, a true beginners book on Android programming and development. No Experience required.

    Email me when the book is available

    On Learning

    • Top Languages Used in Web Development
    • How To Learn a Programming Language: 5 Tips
    ©LearnToProgram.tv 2012 .All rights reserved.