Welcome to Dream.In.Code
Getting Help is Easy!

Join 105,755 Programmers for FREE! Ask your question and get quick answers from experts. There are 1,752 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



tutorial/code

 
Reply to this topicStart new topic

tutorial/code

Joe123
post 3 Jul, 2008 - 02:10 AM
Post #1


New D.I.C Head

*
Joined: 8 May, 2008
Posts: 27

Hi im following this tut
but i dont understand what it means when it says "click on the } Sign"
so i have posted the code and the tutorial

Step1: Make your object.
Step2: Turn it into a movieclip.
Step3: Right click on it> Actions.
Step4: Copy and paste following code.

CODE
onClipEvent (load) {
speed = 5;
}


(This determines the allround speed)

Step5: Change the digit 5 to the speed you want.
Step6: Click on the } sign.
Step7: Copy and paste following code.


CODE
onClipEvent (enterFrame) {
if (key.isdown(key.LEFT)) {
_x-= speed;
}
if (key.isdown(key.RIGHT)) {
_x+= speed;
}
if (key.isdown(key.DOWN)) {
_y+= speed;
}
if (key.isdown(key.UP)) {
_y-= speed;
}
}


(This determines the position of itself relative to the speed varible)
Step8: Control> Test Movie
Well done! You have just made an object which can go in 8 different
directions! Now you can simply sign that to any object you wish!

can anyone help?
User is offlineProfile CardPM

Go to the top of the page


BetaWar
post 3 Jul, 2008 - 08:19 AM
Post #2


#include <soul.h>

Group Icon
Joined: 7 Sep, 2006
Posts: 1,011



Thanked 32 times

Dream Kudos: 675
My Contributions


Pretty sure it is just saying to get the code looking like so:

CODE
onClipEvent (load) {
speed = 5;
}
onClipEvent (enterFrame) {
if (key.isdown(key.LEFT)) {
_x-= speed;
}
if (key.isdown(key.RIGHT)) {
_x+= speed;
}
if (key.isdown(key.DOWN)) {
_y+= speed;
}
if (key.isdown(key.UP)) {
_y-= speed;
}
}


Because, when you click on the } the i bar moves to the end of the of the character (at least in IE6) so then you paste the ocde in and it will be after the previous code.

Hope that helps.
User is offlineProfile CardPM

Go to the top of the page

Joe123
post 7 Jul, 2008 - 02:36 AM
Post #3


New D.I.C Head

*
Joined: 8 May, 2008
Posts: 27

thanks, ermm its maybe that but im probaly doing sumthing wrong,
aside from that
would you know anything about the below

CODE
//define number of layer.
var layer = 10;
//number of items in a layer
var items = 25;
//create the bg that holds the layers
this.createEmptyMovieClip("bgHolder", this.getNextHighestDepth());
//this function will update the layers current position
function updateMovies() {
//easingStrenth
d = 10;
this.x = _root._xmouse;
this.y = _root._ymouse;
//get the linear relation fo x.
var coef = (Stage.width-this._width)/Stage.width;
//update x with easing.
this._x -= (this._x-coef*this.x)/d;
//get the linear relation fo y.
coef = (Stage.height-this._height)/Stage.height;
//update y with easing.
this._y -= (this._y-coef*this.y)/d;
}
//init function for the layers
function init() {
for (i=0; i<layer; i++) {
  //create a layer
  temp = this.bgHolder.createEmptyMovieClip("bg"+i, this.bgHolder.getNextHighestDepth());
  depth = temp.getNextHighestDepth();
  //create a virtual bag for the layer to define it height and width.
  virtual_mc = temp.attachMovie("virtual", "vitrual"+depth, depth, {_visible:false, _width:(i+2)*Stage.width, _height:(i+2)*Stage.height});
  //put the items into the layer
  for (j=0; j<items; j++) {
   depth = temp.getNextHighestDepth();
   //attach an item
   temp1 = temp.attachMovie("float1", "float"+depth, depth);
   //position it randomly in the current layer
   temp1._x = Math.random()*(i+2)*Stage.width;
   temp1._y = Math.random()*(i+2)*Stage.height;
   //scale it randomly
   rand = Math.random();
   temp1._xscale *= .10+rand;
   temp1._yscale *= .10+rand;
   //put is opacity randomly
   temp1._alpha = random(80)+20;
  }
  //each layer share the same updating function.
  temp.onEnterFrame = this.updateMovies;
}
}
init();


now this code works fine, but would you know what to add to it, to make the user click on the box eg. to view photos/photo album?

thanks

User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 8/21/08 12:33PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month