Teil von  SELFPHP
  +++ SELFPHP CronJob-Service :: Jetzt auch als Professional-Version verfügbar! +++

:: Anbieterverzeichnis ::

Globale Branchen

Informieren Sie sich über ausgewählte Unternehmen im Anbieterverzeichnis von SELFPHP  

 

:: SELFPHP Forum ::

Fragen rund um die Themen PHP? In über 120.000 Beiträgen finden Sie sicher die passende Antwort!  

 

:: Newsletter ::

Abonnieren Sie hier den kostenlosen SELFPHP Newsletter!

Vorname: 
Name:
E-Mail:
 
 

:: Qozido ::

Die Bilderverwaltung mit Logbuch für Taucher und Schnorchler.   

 
 
Adding and Applying Behaviors


SELFPHP Produktempfehlung
Microsoft Windows Server 2008
Seite Windows Server 2008
Seite

Microsoft SQL Server 2008
Seite SQL Server 2008
Seite

Microsoft Expression Web 3
Seite Microsoft Expression
Seite







What you’ll learn in this module:

Behavior Overview
Adding Classes
Adding a System Reference
Applying Behaviors
Modifying the properties of a behavior


Venture into Gaming Using Expression Blend: Module 5

Adding and Applying Behaviors

A helpful new feature in Expression Blend 3 is the availability of behaviors, which are pre-created packages of code that save time and eliminate the need to write the code needed to carry out common tasks. You can easily apply behaviors to objects in your application for timeline control, button hook-ups, complex interactive behavior (such as drag and drop) and more. Behaviors are located in the Asset Library, and are applied via drag-and-drop directly to the Objects & Timeline panel.

Overview of Behaviors
Expression Blend 3 comes with a number of behaviors installed, for example the ControlStoryboardAction behavior, which lets you stop, start, pause and resume storyboards when a specific trigger occurs in your application. Triggers represent any action that can cause a reaction. Common triggers include mouse clicks, rollovers, and key presses. Some triggers occur without user intervention, such as the loading of a specific control or some data in your application.

Although there are built-in behaviors that come packaged in the Microsoft.Expression. Interactions.dll assembly that is part of the Blend SDK you can add more behaviors by writing our own or adding references to additional assemblies.

Adding Custom Behaviors to Your Project
Your Bee Hive game has a number of elements that must fall into place for the game to work. Writing the code that allows the paddle to follow your mouse movement or the functionality for saving a player’s high score is not something most people want to do from scratch. Additionally, this sort of behavior is similar from game to game, although the mechanics may be different. Adding behavior code that has been thoroughly tested gives you one less thing to worry about when creating games. In this section you’ll add the behaviors for the following game play: FollowMouse, HighScore, Lives, Score, GameEnvironment, LastScore and Motion.

  1. Open the BeeHive Solution file in Blend, then right-click the Solution and choose Open in Visual Studio.
  2. Within Visual Studio, right-click the beehive project file and choose Add Existing Item. Navigate to the Beehive folder associated with this module and Browse to the Beehice subfolder. The Behaviors you will be adding are C# files (and technically they are “classes”)
  3. Press and hold down the Ctrl key and select the following files: followmouse.cs, Collision.cs, Highscore.cs, Lives.cs, Score.cs, GameEnvironment.cs, LastScore.cs and Motion.cs. Press Add.




  4. Press F5 to compile your application, you will receive errors because these behaviors make use of an assembly named “System.Windows.Interactivity,” so you will now create a reference to this Assembly.
  5. Expand the References folder within your project by clicking on the plus sign, then right-click the folder and choose Add Reference. Within the .Net tab, scroll down and locate “System.Windows.Interactivity,” select it, then press OK.




  6. Press F5 again to compile and you will receive a “Build Succeeded” message. Your Behaviors will now be available for use in Expression Blend. Toggle Back to Blend and reload the application,if prompted.
  7. To confirm that your new behaviors are available for use in Blend, click the Assets Panel, then click the Behaviors Section, you will see the new behaviors listed here.





Seite 1 von 2 1 2



Downloads

Copyright © 2010
Microsoft Deutschland GmbH
Alle Rechte vorbehalten.

 Microsoft Deutschland GmbH
 




:: Premium-Partner ::

Webhosting/Serverlösungen


Premium-Partner MECO Systemhaus GmbH & Co. KG
Premium-Partner PSW GROUP GmbH & Co. KG
Premium-Partner BPI-Systeme
Premium-Partner Pixel X
Premium-Partner
 

:: SELFPHP Sponsoren ::


DM Solutions
Microsoft Deutschland GmbH
twosteps.net - ...Premium-Webhosting
Sedo - Bei uns wird PHP großgeschrieben
hostfactory.ch - OptimaNet Schweiz AG
ZEND - The PHP Company
Kaspersky Labs
HighText iBusiness
SELFPHP Sponsoren
 

Qozido


© 2001-2013 E-Mail SELFPHP OHG, info@selfphp.deImpressumKontakt