Trying to get a movieclip to display on top of an externally loaded swf
I am trying to ensure that a movieclip named "Incorrect"
displays on top of a swf file that loads with the following:
loadMovieNum("map.swf",1);
I'm sure it's pretty simple, but I couldn't find any good
reference to a movieclip loading on top of an external swf. I tried
loading the map.swf into a placeholder movieclip and doing a
swapDepth, but then the code within the map.swf would no longer
function properly.
thanks.
you must load that movieclip into a _level greater than 1.
there is no work-around if you load map.swf into _level1.
you could load map.swf into a target movieclip and then use
the swapDepths() method of movieclips to control the apparent depth
of map.swf and your movieclip.
Similar Messages
-
I am trying to get itunes to burn a disc on a Samsung external drive but I get a message disc burner or software not found. Itunes 11.1.5.5 does recognize a bought disc in the drive.
Try HT203242: iTunes for Windows: Optical drive is no longer recognized, or "Disc burner or software not found" alert after install.
tt2 -
Trying to get an image to display
Using the following query. I'm able to pull information from two tables and it's working
<cfparam name="PageNum_rsGetProducts" default="1">
<cfquery name="rsGetProducts" datasource="laurie">
SELECT product_ID, product_MerchantProductID, product_Name, product_Description, product_ShortDescription, prdctImage_ProductID, prdctImage_FileName
FROM dbo.tbl_products, dbo.tbl_prdtImages
WHERE product_ID = prdctImage_ProductID
ORDER BY product_Name
</cfquery>
<cfset MaxRows_rsGetProducts=10>
<cfset StartRow_rsGetProducts=Min((PageNum_rsGetProducts-1)*MaxRows_rsGetProducts+1,Max(rsGetPro ducts.RecordCount,1))>
<cfset EndRow_rsGetProducts=Min(StartRow_rsGetProducts+MaxRows_rsGetProducts-1,rsGetProducts.Rec ordCount)>
<cfset TotalPages_rsGetProducts=Ceiling(rsGetProducts.RecordCount/MaxRows_rsGetProducts)>
This is the HTML
<body>
<table border="1">
<tr>
<td>product_ID</td>
<td>product_MerchantProductID</td>
<td>product_Name</td>
<td>product_Description</td>
<td>product_ShortDescription</td>
<td>pic </td>
</tr>
<cfoutput query="rsGetProducts" startRow="#StartRow_rsGetProducts#" maxRows="#MaxRows_rsGetProducts#">
<tr>
<td>#rsGetProducts.product_ID#</td>
<td>#rsGetProducts.product_MerchantProductID#</td>
<td>#rsGetProducts.product_Name#</td>
<td>#rsGetProducts.product_Description#</td>
<td>#rsGetProducts.product_ShortDescription#</td>
<td><img src="#rsGetProducts.prdctImage_FileName#" /></td>
</tr>
</cfoutput>
</table>
</body>
</html>
However, the iamge doesn't display. All I get is the x. I went into DW and bound it to img.src and it's still not working - how can I get this to workSome things for you to check:
does the image exist in the location referred to by the retrieved link?
was the image created as RGB rather than CYMK?
In general, you'll want all your images in a specific directory. -
Trying to get Row numbes to display in a DefaultTableCellRenderer
Hello all.
I have extended the defaultablecellrenderer and have got my JTanle to use it. Howeve, i want to represent the rows of the tables as well as the colums...so far i have managed to colour each row (by colour the first colum of the JTable) is there a wat to number these values, give the number of rows as an arguement? Many thanks, Rupesh.
I call the renderer by
_renderer = new MyTableCellRenderer();
myTable.setDefaultRenderer(Object.class, _renderer );
Btw - when i enter data into my table, it just disappears as soon as i click on another cell..is this because i havent implemented a setValue method in the renderer yet?
import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.border.*;
import java.awt.Component;
import java.awt.Color;
import java.awt.Rectangle;
import java.util.*;
import java.awt.*;
public class MyTableCellRenderer extends DefaultTableCellRenderer{
private Font cellFont;
public MyTableCellRenderer() {
super();
private boolean isHeaderCell(int row, int column){return column == 0;}
public Component getTableCellRendererComponent (JTable myTable, Object value, boolean isSelected, boolean hasFocus, int row, int column){
if (isSelected && !(isHeaderCell(row,column))){
super.setForeground(myTable.getSelectionForeground());
super.setBackground(myTable.getSelectionBackground());
else{
if (isHeaderCell (row, column)){
super.setBackground(Color.lightGray);
super.setForeground(myTable.getForeground());
else {
super.setForeground(myTable.getForeground());
super.setBackground(myTable.getBackground());
cellFont = new Font("Times", Font.PLAIN, 20);
setFont(cellFont);
if (hasFocus) {
setBorder(UIManager.getBorder("Table.focusCellHighlightBorder"));
if (myTable.isCellEditable(row,column)) {
super.setForeground(UIManager.getColor("Table.focusCellForeground"));
super.setBackground(UIManager.getColor("Tale.focusCellBackground"));
else {setBorder(noFocusBorder);}
Color bDis = getBackground();
boolean colourEquals = (bDis != null) && (bDis.equals(myTable.getBackground()) ) & myTable.isOpaque();
setOpaque (!colourEquals);
return this;
}Maybe this is what you are looking for. This code adds a line number for each row in the table:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.table.*;
public class LineNumberTable extends JTable
protected JTable mainTable;
public LineNumberTable(JTable table)
super();
mainTable = table;
setModel(new RowNumberTableModel());
setPreferredScrollableViewportSize(getPreferredSize());
getColumnModel().getColumn(0).setPreferredWidth(50);
getColumnModel().getColumn(0).setCellRenderer( mainTable.getTableHeader().getDefaultRenderer() );
public int getRowHeight(int row)
return mainTable.getRowHeight();
class RowNumberTableModel extends AbstractTableModel
public int getRowCount()
return mainTable.getModel().getRowCount();
public int getColumnCount()
return 1;
public Object getValueAt(int row, int column)
return new Integer(row + 1);
public static void main(String[] args)
Object[][] data = { {"1", "A"}, {"2", "B"}, {"3", "C"} };
String[] columnNames = {"Number","Letter"};
DefaultTableModel model = new DefaultTableModel(data, columnNames);
JTable table = new JTable(model);
JScrollPane scrollPane = new JScrollPane( table );
JTable lineTable = new LineNumberTable( table );
scrollPane.setRowHeaderView( lineTable );
JFrame frame = new JFrame( "Line Number Table" );
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.getContentPane().add(scrollPane, BorderLayout.CENTER);
frame.setSize(400, 300);
frame.setVisible(true);
} -
Externally loaded swf in second window doesn't display properly?
I have a bitmap based flash game (bitmapdata generated screen) that I'm trying to load in to a secondary nativewindow generated from a main flash (not AJAX/HTML) based AIR app that's a graphical menu. I.E. you click on a selection in the menu, and it pops open a secondary nativewindow with the flash game running in it. The problem is, the game itself gets mangled in the secondary window when it loads in. Keyboard input goes away, the bitmap doesn't draw properly (it streaks like its not drawing the background image each frame), most of the game objects its supposed to draw in to the bitmap are missing, etc.
When I make the game itself in to its own AIR app and run it direct, it works just fine. So I'm puzzled. Is there some kind of special coding considerations in the as3 side that I'm missing with the original game? I.E. if a flash based AIR app launches another nativewindow and loads a swf in to that, does it share some kind of variable set, display list, etc. with the calling window? Something else? Any help would be appreciated.There are a few differences between (A.) letting the AIR runtime load content into the initial window and (B.) loading content into a new NativeWindow.
1. In case A, the stage property is available in the class constructor for the main sprite. In case B, this is not the case. You may have to use an ADDED_TO_STAGE event handler to do some class initialization.
2. In case A, the initial scale is based on the metadata present in the SWF -- this results in the behavior you would expect. In case B, there is no SWF to base the scale on when the window is created, so a default scale is used -- this is rarely results in behavior you would expect (unless the window happens to be created with a size of 72x72 pixels).
If you aren't setting the stage to noScale, then this could account for some of the visual issues. (See http://www.adobe.com/devnet/air/flex/quickstart/launching_windows.html for an explanation of the scaling issues.) The easiest thing to do is to set the Stage scaleMode to noScale and the align property to the top left setting. I'm guessing your drawing code isn't expecting the scaling so things are getting put in the wrong place.
3. In case A, the content is automatically put in the application sandbox. In case B, it depends on the URL.
As for the Keyboard input, this may depend on how you are loading the SWF and from where. This could be related to #3 above, although I would expect to see security errors. How are you adding your keyboard event handlers? -
Im trying to get a panel to display with a text area, but it wont work.
Here is the code:
public ApplicationTest()
frame.setContentPane(this);
frame.setLocation(FRAME_UPPER_LEFT_X_COORD,FRAME_UPPER_LEFT_Y_COORD);
frame.setSize(new Dimension(FRAME_WIDTH,FRAME_HEIGHT));
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.setTitle(WINDOW_TITLE);
frame.setResizable(false);
addMouseListener(this);
addMouseMotionListener(this);
addKeyListener(this);
setFocusable(true);
scrollPane = new JScrollPane(this);
GridLayout glayout=new GridLayout();
setLayout(glayout);
gbc=new GridBagConstraints();
/*Creating the Menu Bar*/
MenuBar=new JMenuBar();
FileMenu=new JMenu("File");
EditMenu=new JMenu("Edit");
HelpMenu=new JMenu("Help");
NewItem=new JMenuItem("New...");
OpenItem=new JMenuItem("Open");
SaveItem=new JMenuItem("Save");
SaveAsItem=new JMenuItem("Save as...");
ExitItem=new JMenuItem("Exit");
MenuBar.add(FileMenu);
MenuBar.add(EditMenu);
MenuBar.add(HelpMenu);
FileMenu.add(NewItem);
FileMenu.add(OpenItem);
FileMenu.add(SaveItem);
FileMenu.add(SaveAsItem);
FileMenu.add(ExitItem);
frame.setJMenuBar(MenuBar);
gbc.weightx=0.5;
gbc.gridx=0;
gbc.gridy=0;
add(TopPanel(),gbc);
frame.setVisible(true);
}//End ApplicationTest()
public JPanel TopPanel()
JPanel temppanel=new JPanel();
TextArea=new JTextArea(20,20);
temppanel.add(TextArea);
return temppanel;
}//End TopPanel()If you have any ideas please let me know
thanks
MikeWhat IS your ApplicationTest class?
Post a small demo code that is generally compilable, runnable and could reproduce your problem. See: http://homepage1.nifty.com/algafield/sscce.html and see
http://riters.com/JINX/index.cgi/Suggestions_20for_20Asking_20Questions_20on_20Newsgroups -
Getting properties from loaded swf
hi there,
I am loading different swfs into my loader object "loader"
and I also have a description of each swf below it ("desc"
"desc_back").. Each swf is different in size and i want to move/
scale "desc" and "desc_back" it to fit. This seems to be kind of
working but it changes to fit the loaded swf before the one I want
it to. it is if it is taking the properties of the last loaded swf
instead of the one just loaded...I have tryed using an onload
listener amoung a number of things. my action script is not very
strong so it could be something simple.
thanks :)you must wait until loading is complete before trying to
access the _width and _height of the about-to-be-loaded swf. ie,
use preloader code or the onLoadInit() method of the
moviecliploader class. -
I have an Ipod Touch 2 and rebuilt my laptop. Reinstalled ITUNES and can't find my applications on ITunes after login. I tried to activate Itunes again but it didn't. How can I get my applications to display on ITUNEs?
It sounds like you essentially have a new computer and unless you restored from a backup your iTunes library would be empty. You can transfer your iTunes purchases from your iPod to the computer by:
iTunes Store: Transferring purchases from your iPhone, iPad, or iPod to a computer
SInce you changed syncing computers. after you move the stuff you need to restore the iPod to factory defaults and sync the stuff back to your iPod. If you had the iPod backup file you could restore from backup.
If you have non-iTunes pruchases you can copy them to your computer by using one of the third-party programs discussed in this previous discussion:
Best iPod to PC -
I keep getting internet explorer cannot display web page when trying to download itunes. This only shows on half the page where the download link would be. My internet connection is fine. Any idea what the problem may be?
You won't see anything obviously related to iCloud, Jimmy. But if you go to the home iTunes Store page while logged into your iTunes Store account, you should see a Purchases link now under the Quick Links header. That's the only part of iCloud active at this time.
Regards. -
Trying to get hypertrend to display signals
I created a series of multistate type objects to display limit switch positions. Each display is a green light for on, and black for off. Each one is displaying the status of a bit-of word, like DL2.V17051:2 for instance. I used the database to save the logical status, and tried to get it to log to the hypertrend with no success. If I do the same thing using a C type contact, it will show up. Why can't I do this?
How do you set the logging for logical status? This is what I do.
I use the Modbus. Connect the 40001.1 to a multistate object. It works fine. The logging is configured in modbus object. Then, create the Hypertrend, the URL is Modbus1.40001.1. The logical trends displays well like this attachment.
You can check if the data is logged or not by MAX. Create the trend view in MAX.
Ryan Shi
National Instruments
Attachments:
untitled.JPG 39 KB -
Trying to get a JEditorPane to highlight the full width of a displayed line
I have displayed the wep page in JEditorPane . Now I'm trying to get a JEditorPane to highlight the full width of a displayed line. All the examples I've tried only highlight the textual content. For example if I have content such as this:
+ Here is some text +
+ some more text +
within a JEditorPane represented by the box above, then highlighting the first row highlights only the 'Here is some text' (represented between [ and ] below).
[ Here is some text ]
[some more text ]
I would like it to highlight the full width of the JEditorPane like the following:( ie Inspecting the Html element in firebug ....)
l Here is some text l
l some more text l
l_________________________l
Is there a way to do this?
Edited by: arunnprakash on Mar 27, 2009 7:59 AMTake a look here:
[http://tips4java.wordpress.com/2008/10/29/line-painter/]
[http://www.java-forums.org/awt-swing/10862-how-select-highlight-entire-row-jtextpane.html]
db -
I have a Power Mac G4 and i am trying to get it to work with my LCD
I have a Power Mac G4 and i am trying to get it to work with my LCD Monitor/TV. The connection on the computer is DVI and the connection on the Monitor is DVI. The Monitor says in the manual to hook up computers using the DVI connection. When I connect the too the monitor says there is no video input. I tried changing the settings on the monitor from PC mode to DVI mode and nothing. I have also tried changing the display on the computer to a couple of different settings and nothing. Please Help?
Hi-
A little more info please.
What model G4?
What Graphics card?
What OS?
What model/make of monitor?
G4AGP(450)Sawtooth, 2ghz PowerLogix, 2gbRAM, RaptorSATAATA, ATI Radeon 9800 Mac OS X (10.4.8) Pioneer DVR-109, 23" ACD, Ratoc USB 2.0, QCam Ultra, Nikon Coolscan -
Hi All,
Seasonal Greetings.
I am new one to bing ads . I am trying to get Campaigns from my sandbox account. The following is my code.
<?php
// To ensure that a cached WSDL is not being used,
// disable WSDL caching.
ini_set("soap.wsdl_cache_enabled", "0");
try
//$accountId = <youraccountid>; // Application-specific value.
$accountId = "8951263";
// Use either the sandbox or the production URI.
// This example is for the sandbox URI.
$URI =
"https://api.sandbox.bingads.microsoft.com/Api/Advertiser/v8/";
// The following commented-out line contains the production URI.
//$URI = "https://adcenterapi.microsoft.com/api/advertiser/v8/";
// The API namespace.
$xmlns = "https://adcenter.microsoft.com/v8";
// The proxy for the Campaign Management Web service.
$campaignProxy =
$URI . "CampaignManagement/CampaignManagementService.svc?wsdl";
// The name of the service operation that will be called.
$action = "GetCampaignsByAccountId";
// The user name, password, and developer token are
// expected to be passed in as command-line
// arguments.
// $argv[0] is the PHP file name.
// $argv[1] is the user name.
// $argv[2] is the password.
// $argv[3] is the developer token.
if ($argc !=4)
printf("Usage:\n");
printf(
"php file.php username password devtoken\n");
exit(0);
$username = $argv[1];
$password = $argv[2];
$developerToken = $argv[3];
$applicationToken = "";
// Create the SOAP headers.
$headerApplicationToken =
new SoapHeader
$xmlns,
'ApplicationToken',
$applicationToken,
false
$headerDeveloperToken =
new SoapHeader
$xmlns,
'DeveloperToken',
$developerToken,
false
$headerUserName =
new SoapHeader
$xmlns,
'UserName',
$username,
false
$headerPassword =
new SoapHeader
$xmlns,
'Password',
$password,
false
$headerCustomerAccountId =
new SoapHeader
$xmlns,
'CustomerAccountId',
$accountId,
false
// Create the SOAP input header array.
$inputHeaders = array
$headerApplicationToken,
$headerDeveloperToken,
$headerUserName,
$headerPassword,
$headerCustomerAccountId
// Create the SOAP client.
$opts = array('trace' => true);
$client = new SOAPClient($campaignProxy, $opts);
// Specify the parameters for the SOAP call.
$params = array
'AccountId' => $accountId,
// Execute the SOAP call.
$result = $client->__soapCall
$action,
array( $action.'Request' => $params ),
null,
$inputHeaders,
$outputHeaders
print "Successful $action call.\n";
print "TrackingId output from response header: "
. $outputHeaders['TrackingId']
. ".\n";
// Insert a blank line to separate the text that follows.
print "\n";
// Retrieve the campaigns.
if (isset(
$result->Campaigns
if (is_array($result->Campaigns->Campaign))
// An array of campaigns has been returned.
$obj = $result->Campaigns->Campaign;
else
// A single campaign has been returned.
$obj = $result->Campaigns;
// Display the campaigns.
foreach ($obj as $campaign)
print "Name : " . $campaign->Name . "\n";
print "Description : " . $campaign->Description . "\n";
print "MonthlyBudget : " . $campaign->MonthlyBudget . "\n";
print "BudgetType : " . $campaign->BudgetType . "\n";
print "\n";
catch (Exception $e)
print "$action failed.\n";
if (isset($e->detail->ApiFaultDetail))
print "ApiFaultDetail exception encountered\n";
print "Tracking ID: " .
$e->detail->ApiFaultDetail->TrackingId . "\n";
// Process any operation errors.
if (isset(
$e->detail->ApiFaultDetail->OperationErrors->OperationError
if (is_array(
$e->detail->ApiFaultDetail->OperationErrors->OperationError
// An array of operation errors has been returned.
$obj = $e->detail->ApiFaultDetail->OperationErrors->OperationError;
else
// A single operation error has been returned.
$obj = $e->detail->ApiFaultDetail->OperationErrors;
foreach ($obj as $operationError)
print "Operation error encountered:\n";
print "\tMessage: ". $operationError->Message . "\n";
print "\tDetails: ". $operationError->Details . "\n";
print "\tErrorCode: ". $operationError->ErrorCode . "\n";
print "\tCode: ". $operationError->Code . "\n";
// Process any batch errors.
if (isset(
$e->detail->ApiFaultDetail->BatchErrors->BatchError
if (is_array(
$e->detail->ApiFaultDetail->BatchErrors->BatchError
// An array of batch errors has been returned.
$obj = $e->detail->ApiFaultDetail->BatchErrors->BatchError;
else
// A single batch error has been returned.
$obj = $e->detail->ApiFaultDetail->BatchErrors;
foreach ($obj as $batchError)
print "Batch error encountered for array index " . $batchError->Index . ".\n";
print "\tMessage: ". $batchError->Message . "\n";
print "\tDetails: ". $batchError->Details . "\n";
print "\tErrorCode: ". $batchError->ErrorCode . "\n";
print "\tCode: ". $batchError->Code . "\n";
if (isset($e->detail->AdApiFaultDetail))
print "AdApiFaultDetail exception encountered\n";
print "Tracking ID: " .
$e->detail->AdApiFaultDetail->TrackingId . "\n";
// Process any operation errors.
if (isset(
$e->detail->AdApiFaultDetail->Errors
if (is_array(
$e->detail->AdApiFaultDetail->Errors
// An array of errors has been returned.
$obj = $e->detail->AdApiFaultDetail->Errors;
else
// A single error has been returned.
$obj = $e->detail->AdApiFaultDetail->Errors;
foreach ($obj as $Error)
print "Error encountered:\n";
print "\tMessage: ". $Error->Message . "\n";
print "\tDetail: ". $Error->Detail . "\n";
print "\tErrorCode: ". $Error->ErrorCode . "\n";
print "\tCode: ". $Error->Code . "\n";
// Display the fault code and the fault string.
print $e->faultcode . " " . $e->faultstring . ".\n";
// Output the last request.
print "Last SOAP request:\n";
print $client->__getLastRequest() . "\n";
?>
http://msdn.microsoft.com/en-us/library/bing-ads-campaign-management-php-samples-get-campaigns(v=msads.80).aspx
But I am getting responce
GetCampaignsByAccountId failed.
ApiFaultDetail exception encountered
Tracking ID: efa654c5-b112-4e96-8c3d-79bac7e70112
Operation error encountered:
Message: This operation is not supported.
Details:
ErrorCode: OperationNotSupported
Code: 204
s:Server Invalid client data. Check the SOAP fault details for more information.
Last SOAP request:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://adcenter.microsoft.com/v8"><SOAP-ENV:Header><ns1:ApplicationToken></ns1:ApplicationToken><ns1:DeveloperToken>BBD37VB98</ns1:DeveloperToken><ns1:UserName>-XXXXXX-</ns1:UserName><ns1:Password>-XXXXX-</ns1:Password><ns1:CustomerAccountId>8951263</ns1:CustomerAccountId></SOAP-ENV:Header><SOAP-ENV:Body><ns1:GetCampaignsByAccountIdRequest><ns1:AccountId>8951263</ns1:AccountId></ns1:GetCampaignsByAccountIdRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>
Please Help me to get out of this .
Thank you in advance.
Deepa VarmaHello Nalin,
Thank you for the reply . Now I am using
$campaignProxy ="https://api.sandbox.bingads.microsoft.com/Api/Advertiser/CampaignManagement/v9/CampaignManagementService.svc?wsdl" ;
// The API namespace.
$xmlns = "https://adcenter.microsoft.com/v9";
$xmlns = "https://bingads.microsoft.com/AdIntelligence/v9";
But I am getting
GetCampaignsByAccountId failed.
AdApiFaultDetail exception encountered
Tracking ID: ca31d743-7b7b-4479-8082-44997d60d549
Error encountered:
Message: Authentication failed. Either supplied credentials are invalid or the account is inactive
Detail:
ErrorCode: InvalidCredentials
Code: 105
s:Server Invalid client data. Check the SOAP fault details for more information.
Last SOAP request:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://bingads.microsoft.com/CampaignManagement/v9" xmlns:ns2="https://adcenter.microsoft.com/v8"><SOAP-ENV:Header><ns2:ApplicationToken></ns2:ApplicationToken><ns2:DeveloperToken>BBD37VB98</ns2:DeveloperToken><ns2:UserName>vbridgellp</ns2:UserName><ns2:Password>XXXX</ns2:Password><ns2:CustomerAccountId>8951263</ns2:CustomerAccountId></SOAP-ENV:Header><SOAP-ENV:Body><ns1:GetCampaignsByAccountIdRequest><ns1:AccountId>8951263</ns1:AccountId></ns1:GetCampaignsByAccountIdRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>
I am able to login to sand box UI and see my campaigns. What may be reason for the error ?
Thank you in Advance.
Deepa Varma -
Hi, I’ve recently bought an iPad2 and can’t get connected with AppStore or iTunes, when I tap on these icons a grey page pops up saying is loading but never opens the page, no failure message is displayed, it just keep saying is loading.
Apparently it is not an issue with wifi since Safari, You Tube and Maps work well, I’ve tried some of the tips, e.g. log off/on my Id, change password but no one worked.
Your help will be highly appreciated.
Thank you.
Luis.Try a reset. Hold the Sleep and Home button down for about 10 seconds until you see the Apple logo. Ignore the red slider.
-
Trying to get a Trigger and Alert to work
So im trying to get a trigger to work with an alert and the Alert seems to be right and the trigger complies which seems right to me, however the instruction that I have in my book does not produce the same output that I get from my Update.
Here is the deal. I am to log into sql * with a default account as well as login as "SYSTEM"
the trigger should invoke the Alert and output a message to re-order some more product and the status should = 0 since there is no wait time. However I don't get a "Message" from the Alert and the status = 1 which indicates timeout. So if you can take a look at my code and let me know what I did wrong or how to "Connect" the two that would be great.
Trigger I created.
CREATE OR REPLACE TRIGGER order_replace_trg
AFtER UPDATE OF stock on bb_product
FOR EACH ROW
WHEN (OLD.stock = 24 AND NEW.stock = -2)
DECLARE
stock NUMBER(5,1);
idproduct NUMBER(2);
lv_msg_txt VARCHAR2(25);
lv_status_num NUMBER(1);
reorder NUMBER(3);
BEGIN
IF stock <> 24 AND reorder = 25 THEN
lv_msg_txt := 'Product 4 Reorder Time!';
DBMS_OUTPUT.PUT_LINE(lv_msg_txt);
ELSE
lv_status_num := 0;
DBMS_OUTPUT.PUT_LINE(lv_status_num);
END IF;
END;
The Alert:
BEGIN
DBMS_ALERT.REGISTER('reorder');
END;
DECLARE
lv_msg_txt VARCHAR2(25);
lv_status_num NUMBER(1);
BEGIN
DBMS_ALERT.WAITONE('reorder', lv_msg_txt, lv_status_num, 120);
DBMS_OUTPUT.PUT_LINE('Alert: ' ||lv_msg_txt);
DBMS_OUTPUT.PUT_LINE('Status: ' ||lv_status_num);
END;
Here is the block I need to run to test the trigger and alert.
UPDATE bb_product
SET stock = stock -2
WHERE idproduct = 4;
COMMIT;
The message I should get is:
Alert: Product 4 Reorder Time!
Status: 0
PL/SQL procedure successfully completed.
This is what I get.
SQL> /
Alert:
Status: 1
PL/SQL procedure successfully completed.
Thanks for your help!
MacRight. Register says "I'm interested in getting alerted to some particular event", Waitone says "I'm waiting until some event happens". Signal is the key thing that indicates that a particular event happened.
As for your trigger, a couple of issues
- I don't know why you're calling DBMS_OUTPUT. I'm guessing that you probably want to send a message along with your alert that the receiver gets and displays, not that you want to print a message to the window from inside the trigger.
- You're using the local variables stock and reorder in your IF statement but you never initialize them. I'm guessing that you would want to eliminate those local variables and just use :new.stock and :new.reorder (assuming that REORDER is a column in the table).
- Your WHEN clause doesn't seem to make sense. It's telling the trigger to fire only if you update stock from 24 to -2, which doesn't make sense. I'm not sure you would even need a WHEN clause here.
Justin
Maybe you are looking for
-
Cannot upgrade to snow leopard
I have a late 2007 iMac (2GHz core 2 Duo). Since I purchased it, it has run Tiger, then Leopard flawlessly. I recently bought a Magic Trackpad which required me to upgrade to Snow Leopard. Unfortunately, 10.6 seems to kernel panic almost as soon as i
-
Plot fill hides the grid.
I want to use color regions on my graph. But, if I use a background image, it doesn't adjust with the scale. If I use plot fill and create data arrays for my boundaries, it hides the grid. Does anyone know how to accomplish this? (see attached pictur
-
Copying from PDF and I get what?
Copying from Adobe PDF "Deviation No.2 - Gas well oxygen" This is what I get: uo8,{xo lle^{ su,; - Z'oN uollB!Ar(l Does anybody have an Idea what is happening? Opened file with Adobe Acrobat Pro 9 Thanks
-
Lenova 3000 C100 (Reset the Pw for Client Security) Password Manager
Can any body help me to reset the pw for Lenova 3000 c100 's Client Security, I forgot the password as I did not use it for long time. Message Edited by tomm1986 on 08-08-2009 12:27 AM
-
HT1379 i have overheating and running slow macbook air...
macbook air running good until yesterday, it is very slow and too much heat on the top of the keyboard... help anybody...:(