How to load livecycle es workspace in flex
i have a problem with flex 3 when i load adobe livecycle workspace only
two folders appear(approval-container and workspace) but the other
folders not appear(api,foundation, queue-sharing, and workspace-ui)
also under the workspace folder a new file appear which is
service-config.xml but the build file not appeared.
Thanx alot i found the solution ,only add service pack 2 and everything will work fine
Similar Messages
-
How to load a tif image in flex
Hi All,
Is it possible to load a tif image in flex. If it's possible
anyone guide me or send me some code snippets regarding how to
display a tif image in flex.
Regards,
Dharma"flexdharma" <[email protected]> wrote in
message
news:ga2d96$p8h$[email protected]..
>
Hi All,
> Is it possible to load a tif image in flex. If it's
possible anyone guide
> me or send me some code snippets regarding how to
display a tif image in
> flex.
Convert it to the much more web-friendly png format. -
How to Load a html page into Flex the application?
I want to load separate html page in to my flex application.
for example
think I am in my shopping cart and I wanna buy something and pay for that.Then I am try to pay they will load a separate html page into my shoipping cart.
How can I do that inside flex application?
Any ideas are appreciated..
thnxHi snkd,
You need to make use of iframe to load html content in Flex application.
Check out the link below...there is also source code included..
http://www.deitte.com/archives/2006/08/finally_updated.htm
Thanks,
Bhasker -
how can we display svg files in flex at runtime using FileReference? Actually we are trying to load the svg file from the local directory.
This should give you the JRE version;
System.out.println(System.getproperty("java.version"));
and this should tell you where its running from;
System.out.println(System.getProperty("java.home"));
There are loads more system properties, check the JDK documentation for java.lang.System and look at the getProperties method which has a list.
Stewart -
How do I export the workspace I set up in CS6 32 bit to the 64 bit version?
I've grown to accept that workspaces can't be simply exported from a previous version of AI and imported into the next one. So I painstakingly set up my workspace in the 32 bit version of Illustrator CS6, all the panels laid up over 2 screens in the way I use them most eficiently to suit my personal workflow, thinking that the 64 bit version would also have the same workspace available once I start it. Silly me! Why should I have thought things could be so straightforward? Well OK, they don't share workspaces - so how do I export my workspace that I saved in the 32 bit AI to the 64 bit version? That must be do-able surely - if we need to switch versions obviously we want to maintain consistency. But I just can't figure out how. Please help.
You need to copy your workspace file manually from the 32 bit version into the 64 bit version.
This is the mac CS5 location (I am at work), and the PC location should be similar. Or do a search of your drive for the workspace name.
You will need to restart for this to take effect. Wou will also probably have to export 32 bit actions, and load them in your 64 bit version along with changing popular setting like paste remembers layers. -
Hi, Is there any way to load a PDF document in a flex
application. Can anyone guide me regarding this issue.
I want an example for loading PDF file in a flex application.
By,
Dharma"flexdharma" <[email protected]> wrote in
message
news:gcurce$evh$[email protected]..
>
Hi. I am having a task of loading a PDF file using
IFrame in
> flex. I
> have created the code. If I run the page through
browser. It's working
> properly. If i run the page using flex, the output file
being overwritten
> each
> time when the page is compiled. How to avoid the output
file being
> overwritten
> several times by flex.
Project>Properties>Flex Compiler>uncheck Generate
HTML Wrapper
HTH;
Amy -
How to load time dimension informatica...
Hi, im new to datawarehouse... Can anybody tell me,how to load time dimension informatica...
Thanks and Regards,
jagadish.Do you mean Informatica, the ETL tool? If you do then I would post your question on the Informatica website as we typically use Oracle Warehouse Builder and Analytic Workspace Manager here at Oracle.
If you want to know hoe to generate a time dimension table, then I would recommend using the Time Dimension Wizard in Warehouse Builder as this will automatically create the target dimension table and populate all the required levels with the correct data values. There is more information on the OWB OTN Home Page
Keith Laker
Oracle EMEA Consulting
OLAP Blog: http://oracleOLAP.blogspot.com/
OLAP Wiki: http://wiki.oracle.com/page/Oracle+OLAP+Option
DM Blog: http://oracledmt.blogspot.com/
OWB Blog : http://blogs.oracle.com/warehousebuilder/
OWB Wiki : http://wiki.oracle.com/page/Oracle+Warehouse+Builder
DW on OTN : http://www.oracle.com/technology/products/bi/db/11g/index.html -
How to load and instantiate FXG at runtime?
Hi
Let's say I have a Flex 4 app whose SWF size in KB/MB should be small. While the app runs, the user might want to make the app load 10 of 1000 FXG components that are available. How to load and instantiate these 10 FXG components?
(I want to avoid compiling an SWF that would contain 1000 FXG components and thus would be large in file size.)
Here are snippets from an example which can instantiate FXG components, but would probably be too large in SWF size if would contain all the FXG components.
fxgstuff/rect.fxg and fxgstuff/circle.fxg contain this:
<fxg:Graphic xmlns:fxg="http://ns.adobe.com/fxg/2008" version="1">
<fxg:Group>
Snippets from the main MXML file:
import fxgstuff.*;
import spark.core.SpriteVisualElement;
public function addRect():void {
var _rect:SpriteVisualElement = new rect;
_rect.x = _x_rect;
_rect.y = _y_rect;
container.addElement(_rect);
public function addCircle():void {
<s:Button label="Add rectangle" click="addRect()"/>
<s:Button label="Add circle" click="addCircle()"/>
<s:Group id="container"/>
TobiYou put each graphic into a MXML Module (not MXML Component) which stays on the server and is loaded at runtime when you request it, as in:
// >>>>> Imports <<<<<
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLLoaderDataFormat;
import flash.net.URLRequest;
import mx.events.ModuleEvent;
import mx.modules.IModuleInfo;
import mx.modules.ModuleManager;
// >>>>> Variable Declarations <<<<<
private var urlLdl:URLLoader;
private var modInfo:IModuleInfo;
private var oneGraphicsModule:Object;
// >>>>> Methods <<<<<
private function moduleLoader( pathToModule:String ):void
// Loading one Module
modInfo = ModuleManager.getModule( pathToModule );
urlLdl = new URLLoader( );
urlLdl.dataFormat = URLLoaderDataFormat.BINARY;
urlLdl.addEventListener( Event.COMPLETE, bytesLoadedHandler );
urlLdl.load( new URLRequest( pathToModule ) );
private function bytesLoadedHandler( event:Event ):void
modInfo.addEventListener( ModuleEvent.READY, moduleLoadedHandler );
modInfo.load( null, null, event.target.data );
private function moduleLoadedHandler( event:ModuleEvent ):void
oneGraphicsModule = modInfo.factory.create();
// Do with the module what you need to . . .
So all of your graphics stay on the server, you "just" need to put each graphic or group of graphics into a MXML Module.
David -
Loading external themes for my flex 4 application.
Hello.
I created a flex application and i created some themes using adobe flash.
when the flex application is running i want it to load a default theme and allow the user to switch themes
while running the application. each time is in a seperate swf file.
what is the recommended method to create the themes?
the method that i know of is to convert the symbols to flex components and publish the flash file and swc,
loading it into my application and then i can use it's components.
when i merge the swc file into the code (Link Type: merge into code) i can use the flex component i created and everything works fine.
the problem is that i want the swc to be loaded on runtime and to be able to load/unload.
Link Type: External - wasn't very useful. when i use any component i just get a blank screen with no errors.
maybe it means that the definition is there so i just need to load the module, so i tried to unzip the swc file,
place the swf file on the web and loading it with the Loader(). i still see a blank screen.
Link Type: Runtime Shared Library (RSL) - is not an option, because i want to be able to load and unload the modules on-the-fly.
Flex module:
Another option was a creating a flex module that loads the assets of the swc file and then to use this module,
the problem is that i found examples on how to load a module if it's a container of some sort and to display it on the screen,
i did not find a mothod to actually load different assets from that module and use them.
so as you can see i'm pretty lost here.
i would guess that using 'Link Type:External' is what i need i just don't know how to load the swc file properly afterwards, but who knows!
thanks for your assistance!
kfirHi,
Thanks for the reply. I'll try to edit the html page and let you know how it goes.
--Hyong -
How to render a pdf file within flex
Hi,
could any one suggest, how to open a pdf file within flex.
we have an application built on flex3.
please suggest.
regards,
JohnHi,
Is it a Flash or AIR app?
If it's an AIR app, then use the HTML/web, where you then can navigate to the URL of your PDF.
If it's an Flash app, then set the wmode to transparent: http://kb2.adobe.com/cps/127/tn_12701.html#main_Using_Window_Mode__wmode__values_
And then create an iframe in your HTML page, where you load you PDF, set the iframe z-index, so it gets shown on top of the Flash object. Then you kan use the javascript bridge to interact with the iframe.
Best regards
Martin -
How to load a Jar file in the class path?
How to load a Jar file which contains class files, images, etc.. in the classpath without using URLClassLoader.
You don't "load" jars. If it's on the classpath, you can obtain individual resources from it using various methods on either Class or ClassLoader. Do you mean "how to add a jar to the classpath at runtime"? Can't be done without using a classloader, typically URLClassLoader or a subclass thereof. Why you want to not use the proven method is beyond me. Presumably because you don't understand classloading. In which case, forget it.
-
How to load a client file in a clob using sqlcl
How to load a client file in a clob using sqlcl
You don't "load" jars. If it's on the classpath, you can obtain individual resources from it using various methods on either Class or ClassLoader. Do you mean "how to add a jar to the classpath at runtime"? Can't be done without using a classloader, typically URLClassLoader or a subclass thereof. Why you want to not use the proven method is beyond me. Presumably because you don't understand classloading. In which case, forget it.
-
How to load data to a cube from multiple infosources ?
Hi friends,
How to load data to a cube from multiple infosources ? could u please answer this question .
thanks in advance......Hi ,
say for example you need to load data to 1 cube from 3 info sources:
1) You need to create 3 update rules for the Cube.
2) Each time you create the update rules. Mention the name the name of the Info source. and create update rules correspondingly.
Regards
satish
Message was edited by:
satish murthy -
Hi :
How to load beginning balance to repective g/l account in SAP?If you want to load balances at the time of go live.
Create a clearing account like data take over A/c
MM will upload material balances using tcode MB1C and movement type 561
it will generate the following accounting entry
Finished goods stock a/c Debit
Semi-Finished goods stock a/c Debit
Raw Material stock a/c Debit
Packing Material stock a/c Debit
Stores and spares a/c Debit
Data take over Credit
Customer a/c (not recon G/l) Debit
Data takeover a/c Credit
Data takeover a/c Debit
Vendor a/c (not recon GL) Credit
For Asset - tcode OASV
Plant and Machinery a/c Dr
Accumulated depreciation a/c Credit
Data takeover a/c Credit
Cash balance through FBCJ
G/L Tcode F-02,
Data takeover a/c Debit (Balancing figure)
Bank a/c Debit
Advances Debit
Share capital a/c Credit
Short term Loan a/c Credit
Long term loan a/c Credit -
How do i pass a variable in flex
i've been looking all over google for how to pass a variable yet
i've come up empty handed
i have a C code and as3
i've never been able to get a C program to compile on my own, this is from a tutorial im trying to understand about raycasting
from what i can gather i think that the variables are passed threw this
#######raycaster.c##########
AS3_Val loop( void* self, AS3_Val args )
AS3_ArrayValue(args,"IntType,IntType,IntType,IntType",&K_UP,&K_DOWN,&K_LEFT,&K_RIGHT);
CastRay();
int opos,j,i,jpos;
for(j=0; j < resY; j++ ){
jpos = resX*j;
for(i=0; i < resX; i++ ){
opos = (jpos+i);
tBuffer[opos] = buffer[i][j];
}//end of for
}//end of for
return 0;
}//end of loop
however not one of the values inside of AS3_ArrayValue is to be found on the Main.as
this is the only function that comunicates with the C code, but i could be wrong
####Main.as######
private function enterFrame(event:Event):void {
alcRCLib.loop(upKey,downKey,leftKey,rightKey);
alchemyMemory.position=alcScreenBufferPointer;
screenBitmapData.setPixels(screenBitmapData.rect,alchemyMemory);
the reason i want to do this, other than to know how, because that would be useful above all else, i've already written a as3 that comunicates with php
to get a array of images for a topdown game, and i wouldn't know how to load these variables to C from a HTTP request but if i can get flash to tell c what they are then every thing worked out
heres both codes in full
#####Main.as####
*Alchemy Ray Caster
*April 6, 2010
*Bruce Jawn
*http://bruce-lab.blogspot.com
*Copyright (c) <2010> <Bruce Jawn>
*This software is released under the MIT License
*<http://www.opensource.org/licenses/mit-license.php>
package {
// import cmodule.Ray_Caster._worldMap;
// import cmodule.Ray_Caster._worldMap;
import cmodule.Ray_Caster.CLibInit;
// import cmodule.Ray_Caster.TextFieldI;
import flash.display.*;
import flash.text.*;
import flash.events.*;
import flash.geom.*;
import flash.text.engine.TextBlock;
import flash.text.engine.TextLine;
import flash.text.TextField;
import flash.utils.*;
import flash.ui.*;
[SWF(width="840", height="880")]
public class Main extends Sprite {
[Embed(source="../wolftex/barrel.png")]
public static var barrelClass:Class;
[Embed(source="../wolftex/bluestone.png")]
public static var bluestoneClass:Class;
[Embed(source="../wolftex/colorstone.png")]
public static var colorstoneClass:Class;
[Embed(source="../wolftex/eagle.png")]
public static var eagleClass:Class;
[Embed(source="../wolftex/greenlight.png")]
public static var greenlightClass:Class;
[Embed(source="../wolftex/greystone.png")]
public static var greystoneClass:Class;
[Embed(source="../wolftex/mossy.png")]
public static var mossyClass:Class;
[Embed(source="../wolftex/pillar.png")]
public static var pillarClass:Class;
[Embed(source="../wolftex/purplestone.png")]
public static var purplestoneClass:Class;
[Embed(source="../wolftex/redbrick.png")]
public static var redbrickClass:Class;
[Embed(source="../wolftex/wood.png")]
public static var woodClass:Class;
//Array to hold all the textures
private var texs:Array=[];
private var worldMap:Array = [];
//private var worldMap[1]:Array=[];
private static const SCREEN_WIDTH:int=640;
private static const SCREEN_HEIGHT:int=480;
private var screenBitmapData:BitmapData;
private var screenBitmap:Bitmap;
private var alchemyMemory:ByteArray;
private var alcRCLib:Object;
private var cLibInit:CLibInit;
private var alcScreenBufferPointer:uint;
private var alcTexPointer:uint;
private var upKey:int=0;
private var downKey:int=0;
private var leftKey:int=0;
private var rightKey:int=0;
private var a:flash.text.TextField;
public function Main() {
stage.frameRate=60;
stage.align=StageAlign.TOP_LEFT;
stage.scaleMode=StageScaleMode.NO_SCALE;
stage.fullScreenSourceRect=new Rectangle(0,0,SCREEN_WIDTH,SCREEN_HEIGHT);
init();
}//end of function Main
private function init():void {
initBitmaps();
initAlchemy();
initRendering();
}//end of function init
private function initBitmaps():void {
texs.push(prepareBitmapData(new eagleClass().bitmapData ));
texs.push(prepareBitmapData(new redbrickClass().bitmapData ));
texs.push(prepareBitmapData(new purplestoneClass().bitmapData ));
texs.push(prepareBitmapData(new greystoneClass().bitmapData ));
texs.push(prepareBitmapData(new bluestoneClass().bitmapData ));
texs.push(prepareBitmapData(new mossyClass().bitmapData ));
texs.push(prepareBitmapData(new woodClass().bitmapData ));
texs.push(prepareBitmapData(new colorstoneClass().bitmapData ));
texs.push(prepareBitmapData(new barrelClass().bitmapData ));
texs.push(prepareBitmapData(new pillarClass().bitmapData ));
texs.push(prepareBitmapData(new greenlightClass().bitmapData ));
screenBitmapData=new BitmapData(SCREEN_WIDTH,SCREEN_HEIGHT,false,0);
screenBitmap=new Bitmap(screenBitmapData);
addChild(screenBitmap);
worldMap[1] = (1,2,3,4);
worldMap[2] = (1,2,3,4);
worldMap[3] = (1,2,3,4);
worldMap[4] = (1,2,3,4);
worldMap[5] = (1,2,3,4);
worldMap[6] = (1,2,3,4);
worldMap[7] = (1,2,3,4);
}//end of function initBitmaps
//Prepare the bitmap once to take into account the lower-endianess of the alchemy code.
private function prepareBitmapData(sourceMap:BitmapData):BitmapData {
var outBitmapData:BitmapData=sourceMap.clone();
outBitmapData=new BitmapData(outBitmapData.width,outBitmapData.height,true,0xFF000000);
outBitmapData.copyChannel(sourceMap,outBitmapData.rect,outBitmapData.rect.topLeft,BitmapD ataChannel.ALPHA,BitmapDataChannel.BLUE);
outBitmapData.copyChannel(sourceMap,outBitmapData.rect,outBitmapData.rect.topLeft,BitmapD ataChannel.RED,BitmapDataChannel.GREEN);
outBitmapData.copyChannel(sourceMap,outBitmapData.rect,outBitmapData.rect.topLeft,BitmapD ataChannel.GREEN,BitmapDataChannel.RED);
outBitmapData.copyChannel(sourceMap,outBitmapData.rect,outBitmapData.rect.topLeft,BitmapD ataChannel.BLUE,BitmapDataChannel.ALPHA);
return outBitmapData;
}//end of function prepareBitmapData
private function initAlchemy():void {
cLibInit=new CLibInit ;
alcRCLib=cLibInit.init();
//Retrieve the "Alchemy Memory".
var ns:Namespace=new Namespace("cmodule.Ray_Caster");
alchemyMemory=ns::gstate.ds;
//Allocate the buffers in Alchemy.
alcScreenBufferPointer=alcRCLib.initializeScreenBuffer(SCREEN_WIDTH,SCREEN_HEIGHT);//Setu p a screenbuffer of size x,y;
//Copy the textures to alchemy memory.
for (var i:int=0; i<11; i++) {
var ba:ByteArray=texs[i].getPixels(texs[i].rect);
alcTexPointer=alcRCLib.initializeTexBuffer(i);
alchemyMemory.position=alcTexPointer;
alchemyMemory.writeBytes(ba,0,ba.length);
}//end of for
}//end of function initAlchemy
private function initRendering():void {
stage.addEventListener(KeyboardEvent.KEY_DOWN,key_pressed);
stage.addEventListener(KeyboardEvent.KEY_UP,key_released);
addEventListener(Event.ENTER_FRAME,enterFrame);
}//end of function initRendering
private function enterFrame(event:Event):void {
alcRCLib.loop(upKey,downKey,leftKey,rightKey);
alchemyMemory.position=alcScreenBufferPointer;
screenBitmapData.setPixels(screenBitmapData.rect,alchemyMemory);
}//end of function enterFrame
private function key_pressed(e:KeyboardEvent):void {
switch (e.keyCode) {
case Keyboard.UP :
upKey=1;
break;
case Keyboard.DOWN :
downKey=1;
break;
case Keyboard.LEFT :
leftKey=1;
break;
case Keyboard.RIGHT :
rightKey=1;
break;
}//end of switch
}//end of function key_pressed
private function key_released(e:KeyboardEvent):void {
switch (e.keyCode) {
case Keyboard.UP :
upKey=0;
break;
case Keyboard.DOWN :
downKey=0;
break;
case Keyboard.LEFT :
leftKey=0;
break;
case Keyboard.RIGHT :
rightKey=0;
break;
}//end of switch
}//end of function key_released
}//end of class
}//end of package
###raycaster####
//Raycasting Engine from Lode's Computer Graphics Tutorial
//http://www.student.kuleuven.be/~m0216922/CG/raycasting.html
//Modified for Alchemy by Bruce Jawn
//http://bruce-lab.blogspot.com
#include "AS3.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//============================================================
//============================================================
enum bool {false=0,true=!false};
#define screenWidth 1640
#define screenHeight 1480
#define texWidth 64
#define texHeight 64
#define mapWidth 24
#define mapHeight 24
//1D Screen Buffer
int* tBuffer;
int resX = 0;
int resY = 0;
//2D Screen Buffer
int buffer[screenWidth][screenHeight];
//1D Zbuffer
double ZBuffer[screenWidth];
//============================================================
//============================================================
//textures
int texture[11][texWidth*texHeight];
#define numSprites 19
//arrays used to sort the sprites
int spriteOrder[numSprites];
double spriteDistance[numSprites];
struct SSprite
double x;
double y;
int texture;
struct SSprite sprite[numSprites]=
//green light in front of playerstart
{20.5, 11.5, 10},
//green lights in every room
{18.5,4.5, 10},
{10.0,4.5, 10},
{10.0,12.5,10},
{3.5, 6.5, 10},
{3.5, 20.5,10},
{3.5, 14.5,10},
{14.5,20.5,10},
//row of pillars in front of wall: fisheye test
{18.5, 10.5, 9},
{18.5, 11.5, 9},
{18.5, 12.5, 9},
//some barrels around the map
{21.5, 1.5, 8},
{15.5, 1.5, 8},
{16.0, 1.8, 8},
{16.2, 1.2, 8},
{3.5, 2.5, 8},
{9.5, 15.5, 8},
{10.0, 15.1,8},
{10.5, 15.8,8},
//============================================================
//============================================================
//map
int worldMap[mapWidth][mapHeight] =
{8,8,8,8,8,8,8,8,8,8,8,4,4,6,4,4,6,4,6,4,4,4,6,4},
{8,0,0,0,0,0,0,0,0,0,8,4,0,0,0,0,0,0,0,0,0,0,0,4},
{8,0,3,3,0,0,0,0,0,8,8,4,0,0,0,0,0,0,0,0,0,0,0,6},
{8,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6},
{8,0,3,3,0,0,0,0,0,8,8,4,0,0,0,0,0,0,0,0,0,0,0,4},
{8,0,0,0,0,0,0,0,0,0,8,4,0,0,0,0,0,6,6,6,0,6,4,6},
{8,8,8,8,0,8,8,8,8,8,8,4,4,4,4,4,4,6,0,0,0,0,0,6},
{7,7,7,7,0,7,7,7,7,0,8,0,8,0,8,0,8,4,0,4,0,6,0,6},
{7,7,0,0,0,0,0,0,7,8,0,8,0,8,0,8,8,6,0,0,0,0,0,6},
{7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,6,0,0,0,0,0,4},
{7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,6,0,6,0,6,0,6},
{7,7,0,0,0,0,0,0,7,8,0,8,0,8,0,8,8,6,4,6,0,6,6,6},
{7,7,7,7,0,7,7,7,7,8,8,4,0,6,8,4,8,3,3,3,0,3,3,3},
{2,2,2,2,0,2,2,2,2,4,6,4,0,0,6,0,6,3,0,0,0,0,0,3},
{2,2,0,0,0,0,0,2,2,4,0,0,0,0,0,0,4,3,0,0,0,0,0,3},
{2,0,0,0,0,0,0,0,2,4,0,0,0,0,0,0,4,3,0,0,0,0,0,3},
{1,0,0,0,0,0,0,0,1,4,4,4,4,4,6,0,6,3,3,0,0,0,3,3},
{2,0,0,0,0,0,0,0,2,2,2,1,2,2,2,6,6,0,0,5,0,5,0,5},
{2,2,0,0,0,0,0,2,2,2,0,0,0,2,2,0,5,0,5,0,0,0,5,5},
{2,0,0,0,0,0,0,0,2,0,0,0,0,0,2,5,0,5,0,5,0,5,0,5},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5},
{2,0,0,0,0,0,0,0,2,0,0,0,0,0,2,5,0,5,0,5,0,5,0,5},
{2,2,0,0,0,0,0,2,2,2,0,0,0,2,2,0,5,0,5,0,0,0,5,5},
{2,2,2,2,1,2,2,2,2,2,2,1,2,2,2,5,5,5,5,5,5,5,5,5}
//============================================================
//============================================================
double posX = 22.0, posY = 11.5; //x and y start position
double dirX = -1.0, dirY = 0.0; //initial direction vector
double planeX = 0.0, planeY = 0.66; //the 2d raycaster version of camera plane
int K_LEFT=0;
int K_RIGHT=0;
int K_UP=0;
int K_DOWN=0;
//speed modifiers
double moveSpeed = .30; //the constant value is in squares/second
double rotSpeed = .20; //the constant value is in radians/second
//============================================================
//============================================================
AS3_Val initializeScreenBuffer(void* self, AS3_Val args)
AS3_ArrayValue(args, "IntType, IntType", &resX, &resY);
tBuffer = malloc( resX * resY * sizeof(int) );
return AS3_Ptr( tBuffer );
}//end of initializeScreenBuffer
//used to load some textures & sprite textures
AS3_Val initializeTexBuffer(void* self, AS3_Val args)
int index;
AS3_ArrayValue(args, "IntType", &index);
return AS3_Ptr( texture[index] );
}//end of initializeTexBuffer
//start the main loop
AS3_Val loop( void* self, AS3_Val args )
AS3_ArrayValue(args,"IntType,IntType,IntType,IntType",&K_UP,&K_DOWN,&K_LEFT,&K_RIGHT);
CastRay();
int opos,j,i,jpos;
for(j=0; j < resY; j++ ){
jpos = resX*j;
for(i=0; i < resX; i++ ){
opos = (jpos+i);
tBuffer[opos] = buffer[i][j];
}//end of for
}//end of for
return 0;
}//end of loop
int main()
AS3_Val initializeScreenBufferMethod = AS3_Function( NULL,initializeScreenBuffer );
AS3_Val loopMethod = AS3_Function( NULL,loop );
AS3_Val initializeTexBufferMethod = AS3_Function( NULL,initializeTexBuffer );
AS3_Val result = AS3_Object("initializeScreenBuffer:AS3ValType,loop:AS3ValType,initializeTexBuffer:AS3ValT ype"
,initializeScreenBufferMethod,loopMethod,initializeTexBufferMethod);
AS3_Release( initializeScreenBufferMethod );
AS3_Release( loopMethod );
AS3_Release( initializeTexBufferMethod );
AS3_LibInit( result );
return 0;
}//end of main
//================================================================
//================================================================
void CastRay()
printf ("Hello World!\n");
int x;
int y;
int w=screenWidth;
int h=screenHeight;
for( x = 0; x < screenWidth; x++) for( y = 0; y < screenHeight; y++) {buffer[x][y] = 0;} //clear the buffer instead of cls()
for(x = 0; x < w; x++)
//calculate ray position and direction
double cameraX = 2 * x / (double)(w) - 1; //x-coordinate in camera space
double rayPosX = posX;
double rayPosY = posY;
double rayDirX = dirX + planeX * cameraX;
double rayDirY = dirY + planeY * cameraX;
//which box of the map we're in
int mapX = (int)(rayPosX);
int mapY = (int)(rayPosY);
//length of ray from current position to next x or y-side
double sideDistX;
double sideDistY;
//length of ray from one x or y-side to next x or y-side
double deltaDistX = sqrt(1 + (rayDirY * rayDirY) / (rayDirX * rayDirX));
double deltaDistY = sqrt(1 + (rayDirX * rayDirX) / (rayDirY * rayDirY));
double perpWallDist;
//what direction to step in x or y-direction (either +1 or -1)
int stepX;
int stepY;
int hit = 0; //was there a wall hit?
int side; //was a NS or a EW wall hit?
//calculate step and initial sideDist
if (rayDirX < 0)
stepX = -1;
sideDistX = (rayPosX - mapX) * deltaDistX;
}//end of if (rayDirX < 0)
else
stepX = 1;
sideDistX = (mapX + 1.0 - rayPosX) * deltaDistX;
}//end of else
if (rayDirY < 0)
stepY = -1;
sideDistY = (rayPosY - mapY) * deltaDistY;
}//end of if (rayDirY < 0)
else
stepY = 1;
sideDistY = (mapY + 1.0 - rayPosY) * deltaDistY;
}//end of else
//perform DDA
while (hit == 0)
//jump to next map square, OR in x-direction, OR in y-direction
if (sideDistX < sideDistY)
sideDistX += deltaDistX;
mapX += stepX;
side = 0;
}//end of if (sideDistX < sideDistY)
else
sideDistY += deltaDistY;
mapY += stepY;
side = 1;
}//end of else
//Check if ray has hit a wall
if (worldMap[mapX][mapY] > 0) hit = 1;
}//end of while (hit == 0)
//Calculate distance of perpendicular ray (oblique distance will give fisheye effect!)
if (side == 0) perpWallDist = fabs((mapX - rayPosX + (1 - stepX) / 2) / rayDirX);
else perpWallDist = fabs((mapY - rayPosY + (1 - stepY) / 2) / rayDirY);
//Calculate height of line to draw on screen
int lineHeight = abs((int)(h / perpWallDist));
//calculate lowest and highest pixel to fill in current stripe
int drawStart = -lineHeight / 2 + h / 2;
if(drawStart < 0) drawStart = 0;
int drawEnd = lineHeight / 2 + h / 2;
if(drawEnd >= h) drawEnd = h - 1;
//texturing calculations
int texNum = worldMap[mapX][mapY] - 1; //1 subtracted from it so that texture 0 can be used!
//calculate value of wallX
double wallX; //where exactly the wall was hit
if (side == 1) wallX = rayPosX + ((mapY - rayPosY + (1 - stepY) / 2) / rayDirY) * rayDirX;
else wallX = rayPosY + ((mapX - rayPosX + (1 - stepX) / 2) / rayDirX) * rayDirY;
wallX -= floor((wallX));
//x coordinate on the texture
int texX = (int)(wallX * (double)(texWidth));
if(side == 0 && rayDirX > 0) texX = texWidth - texX - 1;
if(side == 1 && rayDirY < 0) texX = texWidth - texX - 1;
int y;
for(y = drawStart; y < drawEnd; y++)
int d = y * 256 - h * 128 + lineHeight * 128; //256 and 128 factors to avoid floats
int texY = ((d * texHeight) / lineHeight) / 256;
int color = texture[texNum][texWidth * texY + texX];
//make color darker for y-sides: R, G and B byte each divided through two with a "shift" and an "and"
if(side == 1) color = (color >> 1) & 8355711;
buffer[x][y] = color;
}//end of for(y = drawStart; y < drawEnd; y++)
//SET THE ZBUFFER FOR THE SPRITE CASTING
ZBuffer[x] = perpWallDist; //perpendicular distance is used
//FLOOR CASTING
double floorXWall, floorYWall; //x, y position of the floor texel at the bottom of the wall
//4 different wall directions possible
if(side == 0 && rayDirX > 0)
floorXWall = mapX;
floorYWall = mapY + wallX;
}//end of if(side == 0 && rayDirX > 0)
else if(side == 0 && rayDirX < 0)
floorXWall = mapX + 1.0;
floorYWall = mapY + wallX;
}//end of else if(side == 0 && rayDirX < 0)
else if(side == 1 && rayDirY > 0)
floorXWall = mapX + wallX;
floorYWall = mapY;
}//end of else if(side == 1 && rayDirY > 0)
else
floorXWall = mapX + wallX;
floorYWall = mapY + 1.0;
}//end of else
double distWall, distPlayer, currentDist;
distWall = perpWallDist;
distPlayer = 0.0;
if (drawEnd < 0) drawEnd = h; //becomes < 0 when the integer overflows
//draw the floor from drawEnd to the bottom of the screen
for(y = drawEnd + 1; y < h; y++)
currentDist = h / (2.0 * y - h); //you could make a small lookup table for this instead
double weight = (currentDist - distPlayer) / (distWall - distPlayer);
double currentFloorX = weight * floorXWall + (1.0 - weight) * posX;
double currentFloorY = weight * floorYWall + (1.0 - weight) * posY;
int floorTexX, floorTexY;
floorTexX = (int)(currentFloorX * texWidth) % texWidth;
floorTexY = (int)(currentFloorY * texHeight) % texHeight;
//floor
buffer[x][y] = (texture[3][texWidth * floorTexY + floorTexX] >> 1) & 8355711;
//ceiling (symmetrical!)
buffer[x][h - y] = texture[6][texWidth * floorTexY + floorTexX];
}//end of for(y = drawEnd + 1; y < h; y++)
}//end of for(x = 0; x < w; x++)
//SPRITE CASTING
//sort sprites from far to close
int i;
for(i = 0; i < numSprites; i++)
spriteOrder[i] = i;
spriteDistance[i] = ((posX - sprite[i].x) * (posX - sprite[i].x) + (posY - sprite[i].y) * (posY - sprite[i].y)); //sqrt not taken, unneeded
}//end of for(i = 0; i < numSprites; i++)
combSort(spriteOrder, spriteDistance, numSprites);
//after sorting the sprites, do the projection and draw them
for(i = 0; i < numSprites; i++)
//translate sprite position to relative to camera
double spriteX = sprite[spriteOrder[i]].x - posX;
double spriteY = sprite[spriteOrder[i]].y - posY;
//transform sprite with the inverse camera matrix
// [ planeX dirX ] -1 [ dirY -dirX ]
// [ ] = 1/(planeX*dirY-dirX*planeY) * [ ]
// [ planeY dirY ] [ -planeY planeX ]
double invDet = 1.0 / (planeX * dirY - dirX * planeY); //required for correct matrix multiplication
double transformX = invDet * (dirY * spriteX - dirX * spriteY);
double transformY = invDet * (-planeY * spriteX + planeX * spriteY); //this is actually the depth inside the screen, that what Z is in 3D
int spriteScreenX = (int)((w / 2) * (1 + transformX / transformY));
//parameters for scaling and moving the sprites
#define uDiv 1
#define vDiv 1
#define vMove 0.0
int vMoveScreen = (int)(vMove / transformY);
//calculate height of the sprite on screen
int spriteHeight = abs((int)(h / (transformY))) / vDiv; //using "transformY" instead of the real distance prevents fisheye
//calculate lowest and highest pixel to fill in current stripe
int drawStartY = -spriteHeight / 2 + h / 2 + vMoveScreen;
if(drawStartY < 0) drawStartY = 0;
int drawEndY = spriteHeight / 2 + h / 2 + vMoveScreen;
if(drawEndY >= h) drawEndY = h - 1;
//calculate width of the sprite
int spriteWidth = abs( (int) (h / (transformY))) / uDiv;
int drawStartX = -spriteWidth / 2 + spriteScreenX;
if(drawStartX < 0) drawStartX = 0;
int drawEndX = spriteWidth / 2 + spriteScreenX;
if(drawEndX >= w) drawEndX = w - 1;
//loop through every vertical stripe of the sprite on screen
int stripe;
for(stripe = drawStartX; stripe < drawEndX; stripe++)
int texX = (int)(256 * (stripe - (-spriteWidth / 2 + spriteScreenX)) * texWidth / spriteWidth) / 256;
//the conditions in the if are:
//1) it's in front of camera plane so you don't see things behind you
//2) it's on the screen (left)
//3) it's on the screen (right)
//4) ZBuffer, with perpendicular distance
int y;
if(transformY > 0 && stripe > 0 && stripe < w && transformY < ZBuffer[stripe])
for(y = drawStartY; y < drawEndY; y++) //for every pixel of the current stripe
int d = (y-vMoveScreen) * 256 - h * 128 + spriteHeight * 128; //256 and 128 factors to avoid floats
int texY = ((d * texHeight) / spriteHeight) / 256;
unsigned int color = texture[sprite[spriteOrder[i]].texture][texWidth * texY + texX]; //get current color from the texture//??????????????????
if((color & 0x00FFFFFF) != 0) buffer[stripe][y] = color; //paint pixel if it isn't black, black is the invisible color
}//end of for(y = drawStartY; y < drawEndY; y++)
}//end of for(stripe = drawStartX; stripe < drawEndX; stripe++)
}//end of for(i = 0; i < numSprites; i++)
//readKeys
//move forward if no wall in front of you
if (K_UP)
if(worldMap[(int)(posX + dirX * moveSpeed)][(int)(posY)] == false) posX += dirX * moveSpeed;
if(worldMap[(int)(posX)][(int)(posY + dirY * moveSpeed)] == false) posY += dirY * moveSpeed;
}//end of if (K_UP)
//move backwards if no wall behind you
if (K_DOWN)
if(worldMap[(int)(posX - dirX * moveSpeed)][(int)(posY)] == false) posX -= dirX * moveSpeed;
if(worldMap[(int)(posX)][(int)(posY - dirY * moveSpeed)] == false) posY -= dirY * moveSpeed;
}//end of if (K_DOWN)
//rotate to the right
if (K_RIGHT)
//both camera direction and camera plane must be rotated
double oldDirX = dirX;
dirX = dirX * cos(-rotSpeed) - dirY * sin(-rotSpeed);
dirY = oldDirX * sin(-rotSpeed) + dirY * cos(-rotSpeed);
double oldPlaneX = planeX;
planeX = planeX * cos(-rotSpeed) - planeY * sin(-rotSpeed);
planeY = oldPlaneX * sin(-rotSpeed) + planeY * cos(-rotSpeed);
}//end of if (K_RIGHT)
//rotate to the left
if (K_LEFT)
//both camera direction and camera plane must be rotated
double oldDirX = dirX;
dirX = dirX * cos(rotSpeed) - dirY * sin(rotSpeed);
dirY = oldDirX * sin(rotSpeed) + dirY * cos(rotSpeed);
double oldPlaneX = planeX;
planeX = planeX * cos(rotSpeed) - planeY * sin(rotSpeed);
planeY = oldPlaneX * sin(rotSpeed) + planeY * cos(rotSpeed);
}//end of if (K_LEFT)
}//end of CastRay
//sort algorithm
void combSort(int* order, double* dist, int amount)
int gap = amount;
enum bool swapped = false;
while(gap > 1 || swapped)
//shrink factor 1.3
gap = (gap * 10) / 13;
if(gap == 9 || gap == 10) gap = 11;
if (gap < 1) gap = 1;
swapped = false;
int i;
for (i = 0; i < amount - gap; i++)
int j = i + gap;
if (dist[i] < dist[j])
double disttemp=dist[i];
dist[i]=dist[j];
dist[j]=disttemp;
int ordertemp=order[i];
order[i]=order[j];
order[j]=ordertemp;
swapped = true;
}//end of if (dist[i] < dist[j])
}//end of for (i = 0; i < amount - gap; i++)
}//end of while(gap > 1 || swapped)
}//end of combSort
the sorce file can be found here http://bruce-lab.blogspot.com/2010/04/alchemy-ray-casting-engine-source-code.htmlRadioactiveLizard, you need adobe alchemy (http://labs.adobe.com/technologies/alchemy/) to compile the C code to a swc,
not pass variables to C directly.
Maybe you are looking for
-
Extended notifications and UWL
Hi Friends, I am using Extended notifications for sending notifications to lotus notes. In the notification we can maintain shortcut to open the workitem in SAP GUI. But the users use only UWL to access work items.So Is there any way to maintain th
-
Calculation in Adobe Acrobat Pro
I'm creating a simple order-form for my business. I need to assign each option in a drop-down menu for "Quantity" a value; then either add $0 or $10 depending on the option they choose in the "Finishing" drop-down menu (all options add $0 except the
-
Roaming between two WiFi access points fails
Hi... I just bought a Hawking WiFi range extender...a device that acts like a second wireless access point for rooms that are far from your wireless router. It's also known as a repeater. It has the same SSID (network name) as the one set up by the r
-
I have always wondered wht the Thunderbolt does not have an auto-answer option. I happen to be helping an employee with his Droid 3 (he upgraded from a basic phone) and noticed that it was a setting on that phone. I was hoping that with the all the
-
I am trying to track Analyzer versus Excel Add-in usage and need to know know where Essbase writes the "connection source" to a log file. This is displayed in the Connections box within App Mgr in the "connection source" column.Thanks,Steve